(window.webpackJsonp = window.webpackJsonp || []).push([
  [995],
  {
    1022: function (e, t, n) {
      var i = n(613);
      e.exports = function (e, t, n) {
        var a = null == e ? void 0 : i(e, t);
        return void 0 === a ? n : a;
      };
    },
    1085: function (e, t, n) {
      var i = n(1086),
        a =
          /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,
        o = /\\(\\)?/g,
        r = i(function (e) {
          var t = [];
          return (
            46 === e.charCodeAt(0) && t.push(""),
            e.replace(a, function (e, n, i, a) {
              t.push(i ? a.replace(o, "$1") : n || e);
            }),
            t
          );
        });
      e.exports = r;
    },
    1086: function (e, t, n) {
      var i = n(1087);
      e.exports = function (e) {
        var t = i(e, function (e) {
            return 500 === n.size && n.clear(), e;
          }),
          n = t.cache;
        return t;
      };
    },
    1088: function (e, t, n) {
      var i = n(1089);
      e.exports = function (e) {
        return null == e ? "" : i(e);
      };
    },
    1089: function (e, t, n) {
      var i = n(377),
        a = n(734),
        o = n(303),
        r = n(393),
        s = i ? i.prototype : void 0,
        d = s ? s.toString : void 0;
      e.exports = function e(t) {
        if ("string" == typeof t) return t;
        if (o(t)) return a(t, e) + "";
        if (r(t)) return d ? d.call(t) : "";
        var n = t + "";
        return "0" == n && 1 / t == -1 / 0 ? "-0" : n;
      };
    },
    11543: function (e, t, n) {
      "use strict";
      var i = n(145),
        a = n.n(i),
        o = n(1),
        r = n.n(o),
        s = n(2),
        d = n.n(s),
        l = n(16),
        u = n.n(l),
        c = n(260),
        m = n(3915),
        p = n(4670),
        h = n(6),
        f = n(718),
        v = n(1596),
        g = n(2200),
        w = n(1879),
        b = window.rightToLeft ? "right" : "left",
        C = function (e) {
          return e.map(function (e) {
            return Object.assign(
              e.data instanceof Array
                ? (function (e) {
                    return {
                      data: e.data.map(function (e) {
                        return {
                          body: { pos: e.body.pos, len: e.body.len },
                          author: e.author,
                          comment_id: e.comment_id,
                          comment_type: e.comment_type,
                          content: e.content,
                          date: e.date,
                          isTemp: e.isTemp,
                          len: e.len,
                          pos: e.pos,
                          rc_id: e.rc_id,
                          type: e.type,
                          woUserId: e.woUserId,
                          isDone: e.isDone,
                        };
                      }),
                      height: e.height,
                      isTemp: e.isTemp,
                      pageIndex: e.pageIndex,
                      position: Object.assign({}, e.position),
                      truePos: e.truePos,
                    };
                  })(e)
                : (function (e) {
                    var t = {
                      cleanContent: e.cleanContent,
                      wholeContent: e.wholeContent,
                      docType: e.docType,
                      idx: e.idx,
                      rc_id: e.data.rc_id,
                      pageIndex: e.pageIndex,
                      position: e.position,
                      author: e.author,
                      content: e.content,
                      date: e.date,
                      leader: e.leader,
                      revisionType: e.revisionType,
                      user: e.user,
                      userId: e.userID,
                    };
                    return (
                      "format" === e.type &&
                        ((t.cleanContent = Object(g.changeFontNameInText)(
                          t.cleanContent
                        )),
                        (t.wholeContent = Object(g.changeFontNameInText)(
                          t.wholeContent
                        ))),
                      t
                    );
                  })(e),
              {
                id: e.id,
                isNew: e.isNew,
                isJump: e.isJump,
                isVisible: e.isVisible,
                preVisible: e.preVisible,
                type: e.type,
                range: Object.assign({}, e.range),
              }
            );
          });
        },
        y = (function () {
          function e(t, n, i, a) {
            r()(this, e),
              (this.workspace = t),
              (this.app = n),
              (this.rchandler = a),
              (this.cooperInfo = m.a),
              (this._element =
                i.querySelector("cr-list") ||
                Object(f.createElement)({
                  type: "div",
                  style:
                    "position: absolute; top: 0; " +
                    b +
                    ": 0; overflow: visible; width: 300px;",
                  parent: i,
                  classname: "cr-list",
                })),
              (this._comment = null),
              (this.drawComment = this.drawComment.bind(this));
          }
          return (
            d()(e, [
              {
                key: "bindEvents",
                value: function () {
                  window.addEventListener(
                    c.default.comments.COMMENTS_PARA_ACTIVE,
                    this.activeCommentPara
                  ),
                    window.addEventListener(
                      c.default.comments.COMMENTS_PARA_INACTIVE,
                      this.inactiveCommentPara
                    );
                },
              },
              {
                key: "unbindEvents",
                value: function () {
                  window.removeEventListener(
                    c.default.comments.COMMENTS_PARA_ACTIVE,
                    this.activeCommentPara
                  ),
                    window.removeEventListener(
                      c.default.comments.COMMENTS_PARA_INACTIVE,
                      this.inactiveCommentPara
                    );
                },
              },
              {
                key: "clearAll",
                value: function () {
                  (this.lastProps = null),
                    this.unbindEvents(),
                    this.app.frontUtil.ReactDom.unmountComponentAtNode(
                      this._element
                    );
                },
              },
              {
                key: "drawComment",
                value: function () {
                  var e = this,
                    t = void 0;
                  if (this.app.isMobileMode() || this.app.isWebMode()) {
                    var n = this.workspace.currentUsedPage,
                      i = void 0,
                      a = void 0;
                    if (n && n.length) {
                      var o = n[0],
                        r = n[n.length - 1];
                      this.app.data.typoinfo.updater.updatePages({
                        from: o,
                        to: r,
                      });
                      var s = this.app.data.typoinfo.layout_pages[r];
                      (i = this.app.data.typoinfo.layout_pages[o].begin),
                        (a = s ? s.end : void 0);
                    }
                    if (!n || !n.length || void 0 === a) {
                      var d = this.app.data.doc.getSubDocRange(0);
                      (i = d.pos), (a = d.pos + d.len);
                    }
                    t = Object(p.d)(
                      this.app.data,
                      i,
                      a,
                      !this.rchandler.commentVisible,
                      !0
                    );
                  } else {
                    var l = this.workspace.currentUsedPage;
                    t = Object(p.c)(
                      this.app.data,
                      l,
                      !this.rchandler.commentVisible,
                      !0,
                      !1,
                      !1
                    );
                  }
                  var m = t.reduce(function (e, t) {
                      if (t.type === v.CR_TYPE.comments) {
                        var n = (t.data || []).filter(function (e) {
                            return !Object(w.isRefusalToAppeal)(e.comment_id);
                          }),
                          i = !1;
                        i =
                          t.data && t.data[0]
                            ? Object(w.isRefusalToAppeal)(t.data[0].comment_id)
                            : 0 === n.length;
                        var a = (n || []).every(function (e) {
                          return e.isDone;
                        });
                        e.push(
                          u()({}, t.data[0], { id: t.id, isDone: a, isHide: i })
                        );
                      }
                      return e;
                    }, []),
                    h = this.app.commentsDataManager;
                  if (this.app.servicesLoader && h) {
                    var f = this.cooperInfo.coopInfos;
                    m.forEach(function (t) {
                      if (t) {
                        var n = f.find(function (e) {
                          return e.tagid == t.woUserId;
                        });
                        if (n) (t.userid = n.userid), (t.color = n.color);
                        else if (t.comment_id) {
                          var i = h.getCommentCache(t.comment_id);
                          if (i)
                            (t.userid = i.user_info.id),
                              (t.color = e.cooperInfo.getUserColor(t.userid));
                          else {
                            var a =
                              e.app.commentsDataManager.getUserInfoByCommentId(
                                t.comment_id
                              );
                            a &&
                              ((t.userid = a.id),
                              (t.color = e.cooperInfo.getUserColor(t.userid)));
                          }
                        }
                      }
                    });
                  }
                  if (
                    (this.docUserCommentsHandle.activeAllComment(m), !m.length)
                  ) {
                    var g = window.APP.appApi.getCommentShowStatus();
                    g.commentPanel &&
                      c.default.dispatchEvent(
                        c.default.comments.DRAW_CONTENT_BY_COMMENT,
                        g
                      );
                  }
                },
              },
              {
                key: "activeCommentPara",
                value: function (e) {
                  var t = e.detail,
                    n = t.range,
                    i = t.comments,
                    a = t.isPara;
                  this.docUserCommentsHandle.activeCommentPara({
                    range: n,
                    comments: i,
                    isPara: a,
                  });
                },
              },
              {
                key: "inactiveCommentPara",
                value: function () {
                  this.docUserCommentsHandle.inactiveCommentPara(),
                    null === this.rchandler.dataHandler._currItemId &&
                      Object(h.hasQuery)("version") &&
                      c.default.dispatchEvent(
                        c.default.revision.REVISION_ACTIVE_CHANGE,
                        { curId: 0, data: this.rchandler.dataHandler.getData() }
                      );
                },
              },
              {
                key: "hoverCommentPara",
                value: function (e) {
                  var t = e.detail,
                    n = t.range,
                    i = t.comments,
                    a = t.isPara;
                  this.docUserCommentsHandle.hoverCommentPara({
                    range: n,
                    comments: i,
                    isPara: a,
                  });
                },
              },
              {
                key: "outCommentPara",
                value: function () {
                  this.docUserCommentsHandle.outCommentPara();
                },
              },
              {
                key: "filterData",
                value: function (e) {
                  if (this.app.editor) {
                    var t = this.app.editor.viewSettings.revisionMark,
                      n = Object.assign({}, e),
                      i = [],
                      a = [],
                      o = [];
                    return (
                      e.data.forEach(function (n, r) {
                        t.isVisibleForUser(n.author || n.user) &&
                          (i.push(n), a.push(e.tops[r]), o.push(e.ranges[r]));
                      }),
                      (n.data = i),
                      (n.tops = a),
                      (n.ranges = o),
                      (n.length = i.length),
                      n
                    );
                  }
                  return e;
                },
              },
              {
                key: "render",
                value: function (e) {
                  e.data = C(e.data);
                  var t = this.filterData(e);
                  this._comment = this.app.frontUtil.ReactDom.render(
                    this.app.frontUtil.RevisionComment(t),
                    this._element
                  );
                },
              },
              {
                key: "dataHandler",
                get: function () {
                  return this.rchandler.dataHandler;
                },
              },
              {
                key: "comment",
                get: function () {
                  return this._comment;
                },
              },
              {
                key: "docUserCommentsHandle",
                get: function () {
                  return this.app.services.userCommentsManager
                    .docUserCommentsHandle;
                },
              },
            ]),
            e
          );
        })(),
        I = (function () {
          function e(t, n, i, o) {
            var s,
              d = this;
            r()(this, e),
              (this.notify =
                ((s = a()(
                  regeneratorRuntime.mark(function e(t) {
                    var n;
                    return regeneratorRuntime.wrap(
                      function (e) {
                        for (;;)
                          switch ((e.prev = e.next)) {
                            case 0:
                              if ((n = t.detail)) {
                                e.next = 3;
                                break;
                              }
                              return e.abrupt("return");
                            case 3:
                              (e.t0 = n.type),
                                (e.next =
                                  e.t0 === v.NOTIFY_TYPE.deleteText ||
                                  e.t0 === v.NOTIFY_TYPE.insertText ||
                                  e.t0 === v.NOTIFY_TYPE.setProp ||
                                  e.t0 === v.NOTIFY_TYPE.delInsSame
                                    ? 6
                                    : e.t0 === v.NOTIFY_TYPE.insertComment
                                    ? 8
                                    : e.t0 === v.NOTIFY_TYPE.removeComment
                                    ? 10
                                    : e.t0 ===
                                        v.NOTIFY_TYPE.insertCommentText ||
                                      e.t0 === v.NOTIFY_TYPE.deleteCommentText
                                    ? 12
                                    : 14);
                              break;
                            case 6:
                              return d.changeText(n), e.abrupt("break", 15);
                            case 8:
                              return (
                                Promise.resolve().then(function () {
                                  d.insertComment(n);
                                }),
                                e.abrupt("break", 15)
                              );
                            case 10:
                              return d.deleteComment(n), e.abrupt("break", 15);
                            case 12:
                              return (
                                d.editCommentBody(n), e.abrupt("break", 15)
                              );
                            case 14:
                              return e.abrupt("break", 15);
                            case 15:
                            case "end":
                              return e.stop();
                          }
                      },
                      e,
                      d
                    );
                  })
                )),
                function (e) {
                  return s.apply(this, arguments);
                })),
              (this.changeText = t),
              (this.insertComment = n),
              (this.deleteComment = i),
              (this.editCommentBody = o),
              this.bindEvents();
          }
          return (
            d()(e, [
              {
                key: "clearAll",
                value: function () {
                  this.unbindEvents();
                },
              },
              {
                key: "bindEvents",
                value: function () {
                  window.addEventListener(
                    c.default.comments.COMMENTS_PARAS_INVALID,
                    this.notify
                  );
                },
              },
              {
                key: "unbindEvents",
                value: function () {
                  window.removeEventListener(
                    c.default.comments.COMMENTS_PARAS_INVALID,
                    this.notify
                  );
                },
              },
            ]),
            e
          );
        })(),
        _ = n(298),
        E = (function () {
          function e(t, n, i) {
            r()(this, e),
              (this._commentVisible = !1),
              (this.workspace = t),
              (this.app = n),
              (this.container = i),
              (this.isShowRevisionBtn = !0);
          }
          var t, n;
          return (
            d()(e, [
              {
                key: "init",
                value: function () {
                  (this.renderHandler = new y(
                    this.workspace,
                    this.app,
                    this.container,
                    this
                  )),
                    (this.notifyHandler = new I(
                      this.changeText,
                      this.insertComment,
                      this.deleteComment,
                      this.editCommentBody
                    )),
                    this.bindEvents();
                  var e = Object(f.getPrefix)();
                  (e = "webkit" === e ? e : ""),
                    (this.transitionEvent =
                      "" === e ? "transitionend" : e + "TransitionEnd"),
                    (this.animationEvent =
                      "" === e ? "animationend" : e + "AnimationEnd"),
                    (this.commentVisible = !0),
                    (this.revisionVisible = !0);
                },
              },
              {
                key: "clearAll",
                value: function () {
                  this.unbindEvents(),
                    this.renderHandler.clearAll(),
                    this.notifyHandler.clearAll();
                },
              },
              {
                key: "getDocCommentData",
                value:
                  ((n = a()(
                    regeneratorRuntime.mark(function e(t, n) {
                      var i,
                        a,
                        o,
                        r,
                        s,
                        d,
                        l = this;
                      return regeneratorRuntime.wrap(
                        function (e) {
                          for (;;)
                            switch ((e.prev = e.next)) {
                              case 0:
                                for (
                                  i = this.app.data.doc.getSubDocRange(
                                    _.MainText
                                  ),
                                    a = Object(p.b)(
                                      this.app.data.doc,
                                      i.pos,
                                      i.pos + i.len
                                    ),
                                    o = t + n,
                                    r = [],
                                    s = t - 1;
                                  s < o;
                                  s += 50
                                )
                                  (d = this.getOnLineData(
                                    a.slice(s, s + 50),
                                    !1
                                  )),
                                    r.push(d);
                                return e.abrupt(
                                  "return",
                                  Promise.all(r).then(function () {
                                    return a
                                      .slice(t - 1, t + n - 1)
                                      .map(function (e) {
                                        var t = e.comment_id,
                                          n = "";
                                        if (((e.userId = void 0), t)) {
                                          var i =
                                              l.app.services &&
                                              l.app.commentsDataManager,
                                            a =
                                              i &&
                                              i.getCommentCache(e.comment_id);
                                          if (a)
                                            (e.userId = a.user_info.id),
                                              (n = a.p_comment_id);
                                          else {
                                            var o =
                                              i && i.getUserInfoByCommentId(t);
                                            o && (e.userId = o.id);
                                          }
                                        }
                                        return {
                                          commentId: t,
                                          rcId: e.rc_id,
                                          replyCommentId: n,
                                          userId: e.userId,
                                          author: e.author,
                                          content: e.content,
                                          date: e.date,
                                          pos: e.pos,
                                          len: e.len,
                                        };
                                      });
                                  })
                                );
                              case 6:
                              case "end":
                                return e.stop();
                            }
                        },
                        e,
                        this
                      );
                    })
                  )),
                  function (e, t) {
                    return n.apply(this, arguments);
                  }),
              },
              {
                key: "waitTimeout",
                value: function () {
                  var e =
                      arguments.length > 0 && void 0 !== arguments[0]
                        ? arguments[0]
                        : 32,
                    t = arguments[1],
                    n = void 0,
                    i = void 0,
                    a = void 0,
                    o = function t() {
                      cancelAnimationFrame(n),
                        performance.now() - i >= e
                          ? a && a()
                          : (n = requestAnimationFrame(t));
                    };
                  return new Promise(function (e) {
                    (a = function () {
                      t && t(), e();
                    }),
                      (i = performance.now()),
                      (n = requestAnimationFrame(o));
                  });
                },
              },
              { key: "bindEvents", value: function () {} },
              { key: "unbindEvents", value: function () {} },
              { key: "insertComment", value: function () {} },
              { key: "changeText", value: function () {} },
              { key: "deleteComment", value: function () {} },
              { key: "editCommentBody", value: function () {} },
              { key: "updateActiveRevisionAndComment", value: function () {} },
              {
                key: "getOnLineData",
                value:
                  ((t = a()(
                    regeneratorRuntime.mark(function e(t) {
                      var n = this,
                        i =
                          !(arguments.length > 1 && void 0 !== arguments[1]) ||
                          arguments[1];
                      return regeneratorRuntime.wrap(
                        function (e) {
                          for (;;)
                            switch ((e.prev = e.next)) {
                              case 0:
                                return (
                                  (e.next = 2),
                                  this.app.commentsDataManager
                                    .getComments(t)
                                    .then(function (e) {
                                      return (
                                        e.forEach(function (t) {
                                          t.p_comment_id &&
                                            i &&
                                            (e.find(function (e) {
                                              return (
                                                e.comment_id === t.p_comment_id
                                              );
                                            }) ||
                                              n.dataHandler.commentIds.push({
                                                comment_id: t.p_comment_id,
                                              }));
                                        }),
                                        !0
                                      );
                                    })
                                );
                              case 2:
                              case "end":
                                return e.stop();
                            }
                        },
                        e,
                        this
                      );
                    })
                  )),
                  function (e) {
                    return t.apply(this, arguments);
                  }),
              },
              {
                key: "docUserCommentsHandle",
                get: function () {
                  return this.app.services.userCommentsManager
                    .docUserCommentsHandle;
                },
              },
              {
                key: "commentVisible",
                get: function () {
                  return this._commentVisible && this.app.isCommentEnabled;
                },
                set: function (e) {
                  this._commentVisible = e;
                },
              },
            ]),
            e
          );
        })();
      t.a = E;
    },
    12644: function (e, t, n) {
      "use strict";
      n.r(t),
        n.d(t, "DOCRevisionCommentPC", function () {
          return se;
        });
      var i = n(16),
        a = n.n(i),
        o = n(12),
        r = n.n(o),
        s = n(145),
        d = n.n(s),
        l = n(1),
        u = n.n(l),
        c = n(2),
        m = n.n(c),
        p = n(39),
        h = n.n(p),
        f = n(147),
        v = n.n(f),
        g = n(40),
        w = n.n(g),
        b = n(11543),
        C = n(260),
        y = n(216),
        I = n(1596),
        _ = n(6),
        E = n(1338),
        T = n(4670),
        M = ["client", "rollback", "closenosave"],
        P = (function () {
          function e(t, n, i) {
            u()(this, e),
              (this.workspace = t),
              (this.versionType = "weboffice"),
              (this.app = i),
              (this.historyVersionObj = this.app.workspace.historyVersionObj),
              (this.revisionCount =
                (this.historyVersionObj &&
                  this.historyVersionObj.revisionCount) ||
                0),
              (this.compareVersion =
                (this.historyVersionObj &&
                  this.historyVersionObj.compareVersion) ||
                0),
              window.__WPSENV__.cache_preview &&
                0 === this.compareVersion &&
                (this.compareVersion = 1),
              (this.preview =
                (this.historyVersionObj && this.historyVersionObj.preview) ||
                !1),
              (this.version = null),
              (this.allData = null),
              (this.rchandler = n),
              (this.getRevisionCount = this.getRevisionCount.bind(this)),
              (this.getContainer = this.getContainer.bind(this)),
              (this.typoUpdate = this.typoUpdate.bind(this)),
              (this.typoDone = this.typoDone.bind(this)),
              this.init();
          }
          var t, n, i, a, o;
          return (
            m()(e, [
              {
                key: "init",
                value:
                  ((o = d()(
                    regeneratorRuntime.mark(function e() {
                      var t = this;
                      return regeneratorRuntime.wrap(
                        function (e) {
                          for (;;)
                            switch ((e.prev = e.next)) {
                              case 0:
                                return (
                                  (this.version = this.getVersion()),
                                  window.addEventListener(
                                    C.default.revision.REVISION_COUNT,
                                    this.getRevisionCount
                                  ),
                                  window.addEventListener(
                                    C.default.names
                                      .DOC_TYPO_UPDATE_CANVAS_POSITION,
                                    this.typoUpdate
                                  ),
                                  window.addEventListener(
                                    C.default.names.DOC_TYPO_ALL_PAGE_DONE,
                                    this.typoDone
                                  ),
                                  (e.next = 6),
                                  this.getDocData()
                                );
                              case 6:
                                this.getVersionType().then(function () {
                                  t.start();
                                });
                              case 7:
                              case "end":
                                return e.stop();
                            }
                        },
                        e,
                        this
                      );
                    })
                  )),
                  function () {
                    return o.apply(this, arguments);
                  }),
              },
              {
                key: "typoUpdate",
                value: function () {
                  this.getDocData();
                },
              },
              {
                key: "typoDone",
                value: function () {
                  this.getDocData(),
                    window.removeEventListener(
                      C.default.names.DOC_TYPO_UPDATE_CANVAS_POSITION,
                      this.typoUpdate
                    ),
                    window.removeEventListener(
                      C.default.names.DOC_TYPO_ALL_PAGE_DONE,
                      this.typoDone
                    );
                },
              },
              {
                key: "start",
                value:
                  ((a = d()(
                    regeneratorRuntime.mark(function e() {
                      var t, n;
                      return regeneratorRuntime.wrap(
                        function (e) {
                          for (;;)
                            switch ((e.prev = e.next)) {
                              case 0:
                                (t = this.isCompareVersion() || this.preview),
                                  (n = this.allData.length),
                                  t
                                    ? (window.APP.workspace.revisionComment.versionCompare.showToast(
                                        this.versionType,
                                        n
                                      ),
                                      window.collection("revision_old"))
                                    : this.isCompareVersion() ||
                                      this.preview ||
                                      (C.default.dispatchEvent(
                                        C.default.revision.REVISION_DATA_END,
                                        {
                                          isShowRevisionPaginator: !0,
                                          data: this.allData,
                                          compareVersion: this.compareVersion,
                                        }
                                      ),
                                      ((this.revisionCount &&
                                        0 === this.revisionCount) ||
                                        (!this.revisionCount &&
                                          0 === this.allData.length)) &&
                                        window.APP.workspace.showToast(
                                          "warn",
                                          _i18n(
                                            "applications.writer.components.other.historyRevision.nothingChange",
                                            "和上个版本对比无改动"
                                          ),
                                          this.getContainer
                                        ),
                                      window.collection("revision_new")),
                                  document.querySelector(
                                    ".component-version-preview"
                                  )
                                    ? window.collection("revision_checkOver")
                                    : window.collection("revision_check");
                              case 4:
                              case "end":
                                return e.stop();
                            }
                        },
                        e,
                        this
                      );
                    })
                  )),
                  function () {
                    return a.apply(this, arguments);
                  }),
              },
              {
                key: "getRevisionCount",
                value: function (e) {
                  (this.revisionCount = e.detail.revisionCount),
                    (this.compareVersion = e.detail.compareVersion),
                    (this.preview = e.detail.preview),
                    window.removeEventListener(
                      C.default.revision.REVISION_COUNT,
                      this.getRevisionCount
                    );
                },
              },
              {
                key: "getVersionType",
                value: function () {
                  var e = this;
                  return new Promise(function (t, n) {
                    window.__WPSENV__
                      .callAPI({
                        method: "GET",
                        url:
                          "/api/v3/office/file/" +
                          window.urlFileId +
                          "/version/" +
                          e.version,
                      })
                      .then(function (n) {
                        var i = n.body,
                          a = null;
                        (a =
                          i.extra && i.extra.ver_type
                            ? i.extra.ver_type
                            : "client"),
                          sessionStorage.setItem("versionType", a),
                          (e.versionType = a),
                          t();
                      })
                      .catch(function () {
                        n("promise reject: get version type: request error");
                      });
                  });
                },
              },
              {
                key: "isCompareVersion",
                value: function () {
                  return !(
                    1 !== this.version && !this.checkVerType(this.versionType)
                  );
                },
              },
              {
                key: "getVersion",
                value: function () {
                  return parseInt(Object(_.getQuery)("version"));
                },
              },
              {
                key: "getContainer",
                value: function () {
                  return this.workspace.element;
                },
              },
              {
                key: "showToast",
                value: function (e, t) {
                  0 === t
                    ? this.preview
                      ? this.workspace.showToast(
                          "warn",
                          "" +
                            _i18n(
                              "applications.writer.components.other.historyRevision.notOnlineVersionCompare",
                              "非线上版本，无法对比前个版本"
                            ),
                          this.getContainer
                        )
                      : "client" === e ||
                        ("rollback" !== e && "closenosave" !== e) ||
                        this.workspace.showToast(
                          "warn",
                          "" +
                            _i18n(
                              "applications.writer.components.other.historyRevision.rollbackVersionCompare",
                              "被恢复版本，无法对比前个版本"
                            ),
                          this.getContainer
                        )
                    : this.preview
                    ? this.workspace.showToast(
                        "warn",
                        "" +
                          _i18n(
                            "applications.writer.components.other.historyRevision.notOnlineVersionShowTip",
                            "非线上版本，无法比较，展示原有的修订记录"
                          ),
                        this.getContainer
                      )
                    : "client" === e ||
                      ("rollback" !== e && "closenosave" !== e) ||
                      this.workspace.showToast(
                        "warn",
                        "" +
                          _i18n(
                            "applications.writer.components.other.historyRevision.rollbackVersionShowTip",
                            "被恢复版本，无法比较，展示原有的修订记录"
                          ),
                        this.getContainer
                      );
                },
              },
              {
                key: "checkVerType",
                value: function (e) {
                  return M.indexOf(e) >= 0;
                },
              },
              {
                key: "getDocData",
                value:
                  ((i = d()(
                    regeneratorRuntime.mark(function e() {
                      var t,
                        n,
                        i,
                        a,
                        o,
                        r = this;
                      return regeneratorRuntime.wrap(
                        function (e) {
                          for (;;)
                            switch ((e.prev = e.next)) {
                              case 0:
                                for (
                                  t = this.app.data.typoinfo.pageCount || 0,
                                    n = [],
                                    i = [],
                                    a = 0;
                                  a < t;
                                  a++
                                )
                                  n.push(a);
                                if (!this.app.isWebMode()) {
                                  e.next = 10;
                                  break;
                                }
                                (o = this.app.data.doc.getSubDocRange(0)),
                                  (i = (i = Object(T.d)(
                                    this.app.data,
                                    o.pos,
                                    o.pos + o.len,
                                    !1,
                                    !1
                                  )).sort(function (e, t) {
                                    return e.range.pos - t.range.pos;
                                  })),
                                  (e.next = 13);
                                break;
                              case 10:
                                return (
                                  (e.next = 12),
                                  Object(T.c)(
                                    this.app.data,
                                    n,
                                    !this.rchandler.commentVisible,
                                    !this.rchandler.revisionVisible,
                                    this.app.isWebMode()
                                  )
                                );
                              case 12:
                                i = e.sent;
                              case 13:
                                return (
                                  i.map(function (e) {
                                    e.type !== I.CR_TYPE.comments &&
                                      ((e.id = e.rc_id),
                                      (e.range = {
                                        pos: e.pos,
                                        len: e.len,
                                        idx: e.pageIndex,
                                        docType: e.docType,
                                      })),
                                      e.position ||
                                        (e.position = {
                                          top: r.rchandler.dataHandler.getPosByRange(
                                            e.range
                                          ),
                                        });
                                  }),
                                  ((null !== this.allData &&
                                    this.allData.length < i.length) ||
                                    null === this.allData) &&
                                    (this.isCompareVersion() ||
                                      C.default.dispatchEvent(
                                        C.default.revision.REVISION_DATA_CHANGE,
                                        { data: i }
                                      ),
                                    (this.allData = i)),
                                  e.abrupt("return", this.allData)
                                );
                              case 16:
                              case "end":
                                return e.stop();
                            }
                        },
                        e,
                        this
                      );
                    })
                  )),
                  function () {
                    return i.apply(this, arguments);
                  }),
              },
              {
                key: "handPrevClick",
                value:
                  ((n = d()(
                    regeneratorRuntime.mark(function e(t) {
                      var n, i;
                      return regeneratorRuntime.wrap(
                        function (e) {
                          for (;;)
                            switch ((e.prev = e.next)) {
                              case 0:
                                if (
                                  ((n = this.allData),
                                  1 !== (i = this.getActiveIndex()))
                                ) {
                                  e.next = 6;
                                  break;
                                }
                                return (e.next = 5), this.getDocData();
                              case 5:
                                n = this.allData;
                              case 6:
                                t &&
                                  window.collection(
                                    "commandbar",
                                    "click",
                                    "revision_previous"
                                  ),
                                  (1 !== i && 0 !== i) || (i = n.length + 1),
                                  this.activeBubble(n, i - 2);
                              case 9:
                              case "end":
                                return e.stop();
                            }
                        },
                        e,
                        this
                      );
                    })
                  )),
                  function (e) {
                    return n.apply(this, arguments);
                  }),
              },
              {
                key: "handNextClick",
                value:
                  ((t = d()(
                    regeneratorRuntime.mark(function e(t) {
                      var n, i;
                      return regeneratorRuntime.wrap(
                        function (e) {
                          for (;;)
                            switch ((e.prev = e.next)) {
                              case 0:
                                if (
                                  ((n = this.allData),
                                  (i = this.getActiveIndex()) !== n.length)
                                ) {
                                  e.next = 6;
                                  break;
                                }
                                return (e.next = 5), this.getDocData();
                              case 5:
                                n = this.allData;
                              case 6:
                                t &&
                                  window.collection(
                                    "commandbar",
                                    "click",
                                    "revision_next"
                                  ),
                                  i === n.length && (i = 0),
                                  this.activeBubble(n, i);
                              case 9:
                              case "end":
                                return e.stop();
                            }
                        },
                        e,
                        this
                      );
                    })
                  )),
                  function (e) {
                    return t.apply(this, arguments);
                  }),
              },
              {
                key: "activeBubble",
                value: function (e, t) {
                  e[t] &&
                    (void 0 !== e[t].idx &&
                      e[t].docType !== I.DOC_TYPE.main &&
                      (this.app.data.selection.selContext.setInHeaderFooterPurely(
                        !0
                      ),
                      this.app.data.selection.selContext.setHeaderfooterLayoutIndex(
                        e[t].idx
                      )),
                    this.app.data.selection.setPosition(e[t].range.pos),
                    this.app.workspace.makesureCursorVisible(),
                    this.rchandler.getAllDataDraw(),
                    this.rchandler.update(),
                    e[t].type == I.CR_TYPE.comments
                      ? this.rchandler.onActive(e[t].range, e[t].id, e[t])
                      : this.rchandler.onActive(e[t].range, e[t].id, e));
                },
              },
              {
                key: "makesureCardVisible",
                value: function (e) {
                  var t = !0,
                    n = window.APP.workspace.config.zoom,
                    i = e.position.top * n,
                    a = document.getElementById("workspace");
                  if (i) {
                    var o = a.clientHeight,
                      r = a.scrollTop;
                    return (
                      (i + 47 + 82 < r || i + 47 + 82 > r + o) &&
                        (this.workspace.scrollTo({ scrollTop: i + 47 + 82 }),
                        (t = !1)),
                      t
                    );
                  }
                },
              },
              {
                key: "getActiveIndex",
                value: function () {
                  for (
                    var e = this.rchandler.dataHandler.currItemId,
                      t = this.allData,
                      n = 0;
                    n < t.length;
                    n++
                  )
                    if (t[n].id === e) return n + 1;
                  return 0;
                },
              },
            ]),
            e
          );
        })(),
        R = n(6267),
        k = n(298),
        O = n(2004),
        D = n(1879),
        S = n(3917),
        x = n(3134),
        A = (function () {
          function e(t, n, i) {
            var a = this;
            u()(this, e),
              (this.filterVisibleCommentsAndRevisions = function (e) {
                return e.reduce(function (e, t) {
                  if (t.type === I.CR_TYPE.comments) {
                    var n = (t.data || []).filter(function (e) {
                      return !Object(D.isRefusalToAppeal)(e.comment_id);
                    });
                    (
                      t.data && t.data[0]
                        ? Object(D.isRefusalToAppeal)(t.data[0].comment_id)
                        : 0 === n.length
                    )
                      ? delete a.dataIdObj[t.id]
                      : ((t.data = n), e.push(t));
                  } else Object(x.isRevisionVisibleByFilter)(t.data) ? e.push(t) : delete a.dataIdObj[t.id];
                  return e;
                }, []);
              }),
              (this.workspace = t),
              (this.app = n),
              (this.rcHandler = i),
              (this.visible = !1),
              (this.data = []),
              (this.scrollTop = []),
              (this.dataIdObj = {}),
              (this._currItemId = null),
              (this._prevItemId = null),
              (this.waitInsertData = []),
              (this.isJumpOutofIndex = 8),
              (this.hasTempComment = !1),
              (this.tempBubbleId = null),
              (this.tempCommentId = null),
              (this.tempRcId = null),
              (this.tempReplyId = null),
              (this.tempReplyTo = null),
              (this.tempRange = null),
              (this.tempTrueBubbleId = null),
              (this.tempTrueCommentId = null),
              (this.reEditCommentId = null);
          }
          return (
            m()(e, [
              {
                key: "checkIsItemVisible",
                value: function (e) {
                  if (e) {
                    if (e.type === I.CR_TYPE.comments)
                      return this.app.isCommentEnabled;
                    var t = this.app.editor;
                    if (
                      t &&
                      !t.viewSettings.revisionMark.isVisibleForUser(
                        e.user || e.author
                      )
                    )
                      return !1;
                    if (!Object(x.isRevisionVisibleByFilter)(e.data)) return !1;
                  }
                  return !0;
                },
              },
              {
                key: "getViewData",
                value: function () {
                  var e = this,
                    t =
                      arguments.length > 0 &&
                      void 0 !== arguments[0] &&
                      arguments[0],
                    n = [],
                    i = [],
                    a = [],
                    o = new Set();
                  return (
                    (this.data = this.data.reduce(function (r, s) {
                      return (
                        o.has(s.id) ||
                          (o.add(s.id),
                          r.push(s),
                          (t && !e.checkIsItemVisible(s)) ||
                            (n.push(s.position ? s.position.top : 0),
                            i.push(
                              s.range
                                ? {
                                    pos: s.range.pos,
                                    len: s.range.len,
                                    idx: s.range.idx,
                                    doctype: s.range.doctype,
                                  }
                                : null
                            ),
                            a.push(s))),
                        r
                      );
                    }, [])),
                    t
                      ? { data: a, tops: n, ranges: i, length: a.length }
                      : {
                          data: this.data,
                          tops: n,
                          ranges: i,
                          length: this.data.length,
                        }
                  );
                },
              },
              {
                key: "getVisibleData",
                value: function () {
                  var e = this;
                  return this.data.filter(function (t) {
                    if (!(t.type === I.CR_TYPE.comments)) {
                      var n = e.app.editor;
                      if (
                        n &&
                        !n.viewSettings.revisionMark.isVisibleForUser(
                          t.user || t.author
                        )
                      )
                        return !1;
                    }
                    return !0;
                  });
                },
              },
              {
                key: "getData",
                value: function () {
                  return this.getViewData(!1);
                },
              },
              {
                key: "getScrollTop",
                value: function (e) {
                  return this.app.isWebMode()
                    ? this.scrollTop[0]
                    : e.pageIndex >= 0
                    ? this.scrollTop[e.pageIndex]
                    : void 0;
                },
              },
              {
                key: "handleFillTempBubble",
                value: function (e, t) {
                  var n = this;
                  if (this.tempTrueBubbleId) {
                    var i = e.find(function (e) {
                      return e.id === n.tempTrueBubbleId;
                    });
                    i
                      ? ((i.id = this.tempBubbleId), i.data.push(t))
                      : (this.makeAndInsertBubble(e, this.tempRange, t),
                        (this.tempTrueBubbleId = null));
                  } else {
                    var a = e.find(function (e) {
                      return (
                        e.range.pos === n.tempRange.pos &&
                        e.range.len === n.tempRange.len + (e.data.length || 0)
                      );
                    });
                    a && a.type === I.CR_TYPE.comments
                      ? ((this.tempTrueBubbleId = a.id),
                        (a.id = this.tempBubbleId),
                        a.data.push(t))
                      : this.makeAndInsertBubble(e, this.tempRange, t);
                  }
                },
              },
              {
                key: "handleFillTempComment",
                value: function (e, t) {
                  var n = this,
                    i = e.find(function (e) {
                      return e.id === n.tempBubbleId;
                    });
                  if (i) i.data.push(t), (this.tempTrueBubbleId = null);
                  else if (this.tempTrueBubbleId)
                    if (this.tempTrueBubbleId === I.TEMP) {
                      var a = e.find(function (e) {
                        return (
                          e.range.pos === n.tempRange.pos &&
                          e.range.len === n.tempRange.len + (e.data.length || 0)
                        );
                      });
                      a && a.type === I.CR_TYPE.comments
                        ? ((this.tempTrueBubbleId = a.id),
                          (a.id = this.tempBubbleId),
                          a.data.push(t))
                        : this.makeAndInsertBubble(
                            e,
                            this.tempRange,
                            t,
                            this.tempBubbleId
                          );
                    } else {
                      var o = e.find(function (e) {
                        return e.id === n.tempTrueBubbleId;
                      });
                      o
                        ? ((o.id = this.tempBubbleId), o.data.push(t))
                        : (this.makeAndInsertBubble(
                            e,
                            this.tempRange,
                            t,
                            this.tempBubbleId
                          ),
                          (this.tempTrueBubbleId = I.TEMP));
                    }
                  else
                    this.makeAndInsertBubble(
                      e,
                      this.tempRange,
                      t,
                      this.tempBubbleId
                    ),
                      (this.tempTrueBubbleId = I.TEMP);
                },
              },
              {
                key: "fillTemp",
                value: function (e) {
                  if (
                    !this.isReEditingComment &&
                    this.hasTempComment &&
                    this.tempRange
                  ) {
                    var t = Object(O.getTempCommentData)();
                    Object(O.isTempBubbleId)(this.tempBubbleId)
                      ? this.handleFillTempBubble(e, t)
                      : Object(O.isTempCommentId)(this.tempCommentId) &&
                        this.handleFillTempComment(e, t);
                  }
                },
              },
              {
                key: "makeAndInsertBubble",
                value: function (e, t, n, i) {
                  var a = Object(O.getTempBubbleData)(t, n, i),
                    o = e.findIndex(function (e) {
                      return Object(T.e)(e, a) > 0;
                    });
                  (o = -1 !== o ? o : e.length), e.splice(o, 0, a);
                },
              },
              {
                key: "getAllData",
                value: function (e, t, n) {
                  var i = this,
                    a = Object(T.c)(
                      this.app.data,
                      e,
                      t,
                      n,
                      this.app.isWebMode()
                    );
                  this.fillTemp(a);
                  var o = this.filterVisibleCommentsAndRevisions(a),
                    r = this.data.length !== o.length;
                  return (
                    (this.data = o.map(function (e) {
                      return i.BuildSingleData(e);
                    })),
                    r
                  );
                },
              },
              {
                key: "BuildSingleData",
                value: function (e) {
                  var t = this,
                    n = e.type === I.CR_TYPE.comments;
                  n ||
                    ((e.id = e.rc_id),
                    (e.range = {
                      pos: e.pos,
                      len: e.len,
                      idx: e.pageIndex,
                      docType: e.docType,
                    }),
                    (e.cleanContent = Object(S.cleanRevisionContent)(
                      e.wholeContent
                    )));
                  var i = this.dataIdObj[e.id];
                  if (i) {
                    var a =
                      this.rcHandler.scrollTop + (this.getScrollTop(i) || 0);
                    e.isNew = !1;
                    var o = i.position
                        ? i.position.top
                        : this.getPosByRange(e.range),
                      r = this.judgeCardVisible(o + i.height, a);
                    (e.position = { top: o }),
                      (e.height = i.height),
                      (e.truePos = i.truePos),
                      (e.isVisible = e.preVisible = r);
                  } else {
                    var s = this.getPosByRange(e.range);
                    (e.isNew = !0),
                      (e.position = { top: s }),
                      (e.truePos = s),
                      (e.isVisible = e.preVisible = !0),
                      (e.height = 98);
                  }
                  if (n) {
                    var d = e.data.find(function (e) {
                      return e.comment_id === t.tempCommentId;
                    });
                    d &&
                      ((this.currItemId = this.tempBubbleId = e.id),
                      (this.tempRcId = d.rc_id),
                      (d.isTemp = !0),
                      (e.isTemp = !0),
                      (this.dataIdObj[I.TEMP] = e));
                  }
                  return (this.dataIdObj[e.id] = e), e;
                },
              },
              {
                key: "getStepData",
                value: function (e, t, n) {
                  var i,
                    a = this,
                    o = Object(T.c)(
                      this.app.data,
                      e,
                      t,
                      n,
                      this.app.isWebMode()
                    ),
                    s = this.filterVisibleCommentsAndRevisions(o).map(function (
                      e
                    ) {
                      return a.BuildSingleData(e);
                    });
                  (i = this.waitInsertData).push.apply(i, r()(s));
                },
              },
              {
                key: "clearWaitInsertData",
                value: function () {
                  this.waitInsertData = [];
                },
              },
              {
                key: "searchData",
                value: function (e) {
                  for (
                    var t =
                        arguments.length > 1 && void 0 !== arguments[1]
                          ? arguments[1]
                          : 0,
                      n =
                        arguments.length > 2 && void 0 !== arguments[2]
                          ? arguments[2]
                          : this.data.length,
                      i =
                        arguments.length > 3 && void 0 !== arguments[3]
                          ? arguments[3]
                          : 1,
                      a = void 0,
                      o = t;
                    o < n && void 0 === (a = e.call(this, this.data[o], o));
                    o += i
                  );
                  return a;
                },
              },
              {
                key: "setModalVisibleById",
                value: function (e) {
                  this.currItemId = e;
                },
              },
              {
                key: "ModifyModalByIndex",
                value: function (e, t, n) {
                  var i = this.getVisibleData();
                  if (0 === i.length) return !1;
                  var a = this.currItemId || t,
                    o = this.dataIdObj[a];
                  if (!o) return console.log("error currId", a), !1;
                  var r = window.APP.restrictEditHandler.isInFormProtectMode;
                  (o.position = {
                    top:
                      "point" !== e || r
                        ? this.getPosByRange(o.range)
                        : this.getPosBySelection(),
                  }),
                    (o.isVisible = !0),
                    (o.isJump = !1);
                  var s = i.findIndex(function (e) {
                    return e.id === a;
                  });
                  if (-1 === s) return !1;
                  for (
                    var d = s + 1,
                      l = s - 1,
                      u = void 0,
                      c = this.app.isWebMode(),
                      m = d;
                    m < i.length;
                    m++
                  ) {
                    u = i[m];
                    var p = i[m - 1];
                    (u.pageIndex === p.pageIndex || c) &&
                      this.nextCardFit(u, p, n, s, m);
                  }
                  for (var h = l; h >= 0; h--)
                    if ((u = i[h])) {
                      var f = this.getHeight(u.id);
                      if (f) {
                        var v = u.position.top;
                        if (v + f > i[h + 1].position.top - 20)
                          v = i[h + 1].position.top - 20 - f;
                        else
                          ({ top: this.getPosByRange(u.range) }).top + f >=
                            i[h + 1].position.top - 20 &&
                            (v = i[h + 1].position.top - 20 - f);
                        (u.preVisible = this.judgeCardVisible(
                          u.position.top + u.height
                        )),
                          (u.isVisible = this.judgeCardVisible(
                            v + u.height,
                            n
                          )),
                          (u.isJump = !0),
                          u.isVisible ||
                            (u.isVisible = this.judgeCardVisible(
                              this.getPos(u.id) + u.height,
                              n
                            )),
                          this.judgeCardPageVisible(v, u.height, n) &&
                            (u.isJump = !1),
                          (u.position = { top: v });
                      }
                    }
                },
              },
              {
                key: "nextCardFit",
                value: function (e, t, n, i, a) {
                  var o =
                    !(arguments.length > 5 && void 0 !== arguments[5]) ||
                    arguments[5];
                  if (!e) return !1;
                  var r = this.getPosByRange(e.range),
                    s = o ? r : e.position.top,
                    d = s;
                  if (t) {
                    var l = this.getHeight(t.id);
                    if (l) {
                      var u = l + t.position.top + 20;
                      s < u && (s = u);
                    }
                  }
                  (e.preVisible = this.judgeCardVisible(d + e.height)),
                    (e.isVisible = this.judgeCardVisible(s + e.height, n)),
                    (e.isJump = !0),
                    e.isVisible ||
                      (e.isVisible = this.judgeCardVisible(
                        this.getPos(e.id) + e.height,
                        n
                      )),
                    void 0 !== i &&
                      this.judgeCardPageVisible(s, e.height, n) &&
                      (e.isJump = !1),
                    (e.position = { top: s });
                },
              },
              {
                key: "ModifyModalToFit",
                value: function () {
                  var e = this,
                    t = this.app.isWebMode();
                  this.getVisibleData().forEach(function (n, i, a) {
                    var o = n,
                      r = a[i - 1];
                    (r && (t || o.pageIndex === r.pageIndex)) || (r = void 0),
                      e.nextCardFit(o, r);
                  });
                },
              },
              {
                key: "ModifyOtherModalToFit",
                value: function () {
                  var e = this.getVisibleData();
                  if (0 === e.length || 1 === e.length) return !1;
                  for (
                    var t = this.app.isWebMode(), n = 1;
                    n < this.data.length;
                    n++
                  ) {
                    var i = e[n],
                      a = e[n - 1];
                    t || i.pageIndex === a.pageIndex || (a = void 0),
                      this.nextCardFit(i, a, null, null, null, !0);
                  }
                },
              },
              {
                key: "ModifyModalToFitPart",
                value: function (e, t) {
                  var n = this,
                    i =
                      arguments.length > 2 &&
                      void 0 !== arguments[2] &&
                      arguments[2],
                    a =
                      arguments.length > 3 &&
                      void 0 !== arguments[3] &&
                      arguments[3],
                    o = -1,
                    r = void 0;
                  if (t) {
                    o = this.deleteCommentGroupById(e, null, i);
                    var s = this.data[o];
                    o = s
                      ? (r = this.getVisibleData()).findIndex(function (e) {
                          return e.id === s.id;
                        })
                      : -1;
                  } else
                    o = (r = this.getVisibleData()).findIndex(function (t) {
                      return t.id === e;
                    });
                  if (-1 === o) return !1;
                  var d = this.app.isWebMode();
                  if (a) {
                    var l = r.findIndex(function (e) {
                      return e.id === n._prevItemId;
                    });
                    if (-1 !== l) {
                      var u = l;
                      (l = Math.min(l, o)), (o = Math.max(u, o)), l && (l -= 1);
                      for (var c = l; c < o; c++) {
                        var m = r[c],
                          p = r[c - 1];
                        if (!p || m.pageIndex === p.pageIndex || d)
                          this.nextCardFit(m, p, null, l, c);
                        else if (c > l + 1) break;
                      }
                    }
                  }
                  for (var h = o; h < r.length; h++) {
                    var f = r[h],
                      v = r[h - 1];
                    if (!v || f.pageIndex === v.pageIndex || d)
                      this.nextCardFit(f, v, null, o, h);
                    else if (h > o) break;
                  }
                },
              },
              {
                key: "onFocusBlur",
                value: function (e) {
                  this.ModifyModalByIndex(null, e);
                },
              },
              {
                key: "getCurrentCommentRange",
                value: function () {
                  if (!this.currItemId) return !1;
                  var e = this.app.data.doc.commentBubbles.getBubbleById(
                    this.currItemId
                  );
                  return !!e && { pos: e.pos, len: e.len };
                },
              },
              {
                key: "onSelectionChanged",
                value: function () {
                  if (this.hasTempComment && this.tempRange)
                    if (Object(O.isTempBubbleId)(this.tempBubbleId)) {
                      var e = this.app.data.selection.getNormalRange();
                      if (0 === e.len) this.delTempComment();
                      else {
                        var t = this.tempRange;
                        (e.pos === t.pos && e.len === t.len) ||
                          Object.assign(this.tempRange, e);
                      }
                    } else if (Object(O.isTempCommentId)(this.tempCommentId)) {
                      var n = this.app.data.doc.commentBubbles.getBubbleById(
                        this.tempBubbleId
                      );
                      if (n) {
                        var i = this.tempRange;
                        (n.pos === i.pos && n.len === i.len) ||
                          Object.assign(this.tempRange, {
                            pos: n.pos,
                            len: n.len,
                          });
                      } else {
                        var a = this.app.data.selection.getNormalRange();
                        if (0 === a.len) this.delTempComment();
                        else {
                          var o = this.tempRange;
                          (a.pos === o.pos && a.len === o.len) ||
                            Object.assign(this.tempRange, a);
                        }
                      }
                    }
                },
              },
              {
                key: "delTempComment",
                value: function () {
                  this.app.uilManager.exitCommentBody(),
                    this.resetTempCommentBubble(),
                    this.setModalVisibleById(),
                    this.rcHandler.doModalToFit();
                },
              },
              {
                key: "setTempCommentBubble",
                value: function (e) {
                  var t = e.bubbleId,
                    n = e.commentId,
                    i = e.rcId,
                    a = e.replyId,
                    o = e.isNotifyTempComment,
                    r = e.range;
                  (this.hasTempComment = !0),
                    (this.tempBubbleId = t),
                    (this.tempCommentId = n),
                    (this.tempRcId = i),
                    (this.tempReplyId = a),
                    (this.tempRange = r),
                    (this.isNotifyTempComment = o);
                },
              },
              {
                key: "setEditingCommentId",
                value: function (e) {
                  this.reEditCommentId = e;
                },
              },
              {
                key: "resetTempCommentBubble",
                value: function () {
                  var e = this,
                    t = this.data.find(function (t) {
                      return t.id === e.tempBubbleId;
                    });
                  if (t) {
                    this.tempBubbleId === I.TEMP &&
                      this.data.splice(
                        this.data.findIndex(function (t) {
                          return t.id === e.tempBubbleId;
                        }),
                        1
                      ),
                      (t.isTemp = !1);
                    var n = t.data.find(function (t) {
                      return t.comment_id === e.tempCommentId;
                    });
                    n &&
                      (this.tempCommentId === I.TEMP &&
                        t.data.splice(
                          t.data.findIndex(function (t) {
                            return t.comment_id === e.tempCommentId;
                          }),
                          1
                        ),
                      (n.isTemp = !1));
                  }
                  (this.dataIdObj[I.TEMP] = null),
                    (this.hasTempComment = !1),
                    (this.isNotifyTempComment = !1),
                    (this.tempBubbleId = null),
                    (this.tempCommentId = null),
                    (this.tempRcId = null),
                    (this.tempReplyId = null),
                    (this.tempReplyTo = null),
                    (this.tempRange = null),
                    (this.tempTrueBubbleId = null),
                    (this.tempTrueCommentId = null),
                    (this.reEditCommentId = null);
                },
              },
              {
                key: "isCurrItemExist",
                value: function () {
                  if (
                    this.currItemId &&
                    this.findCommentGroupById(this.currItemId) >= 0 &&
                    this.dataIdObj[this.currItemId] &&
                    document.getElementsByClassName(
                      "cr_modal_" + this.currItemId
                    )
                  )
                    return !0;
                  return !1;
                },
              },
              {
                key: "findCommentGroupById",
                value: function (e) {
                  return this.searchData(function (t, n) {
                    if (t.id === e) return n;
                  });
                },
              },
              {
                key: "deleteCommentGroupById",
                value: function (e, t) {
                  var n = t;
                  return (
                    n || (n = this.findCommentGroupById(e)),
                    void 0 !== n &&
                      (this.data.splice(n, 1),
                      this.currItemId === e &&
                        ((this.currItemId = null), delete this.dataIdObj[e])),
                    n
                  );
                },
              },
              {
                key: "deleteComment",
                value: function (e) {
                  if (e && e.data && e.data.length > 0) {
                    var t = this.dataIdObj[e.id];
                    (t.range = e.range), (t.data = e.data);
                  } else this.deleteCommentGroupById(this.currItemId);
                },
              },
              {
                key: "judgeCardVisible",
                value: function (e, t) {
                  var n = void 0 === t ? this.rcHandler.scrollTop : t,
                    i = this.rcHandler.height;
                  return e > n - i / 2 && e < n + (3 * i) / 2;
                },
              },
              {
                key: "judgeCardPageVisible",
                value: function (e, t, n) {
                  var i = void 0 === n ? this.rcHandler.scrollTop : n,
                    a = this.rcHandler.height;
                  return e + t > i && e < i + a;
                },
              },
              {
                key: "setCardVisible",
                value: function () {
                  var e = this;
                  this.getVisibleData().forEach(function (t) {
                    var n = e.rcHandler.scrollTop + (e.getScrollTop(t) || 0);
                    if (t.id !== I.TEMP) {
                      var i = t.isVisible;
                      (t.isVisible = e.judgeCardVisible(
                        t.position.top + t.height,
                        n
                      )),
                        (t.preVisible = void 0 !== i ? i : t.isVisible),
                        (t.isJump = !0),
                        !0 === t.preVisible &&
                          !0 === t.isVisible &&
                          (t.isJump = !1),
                        t.isVisible ||
                          (t.isVisible = e.judgeCardVisible(
                            e.getPos(t.id) + t.height,
                            n
                          ));
                    }
                  });
                },
              },
              {
                key: "getPosByRange",
                value: function (e) {
                  if (e && void 0 !== e.pos) {
                    var t = a()({}, e);
                    if (this.app.data.doc.getSubDocType(t.pos) === k.Comment) {
                      var n = this.app.data.doc.commentBodys.getCommentByPos(
                        t.pos
                      );
                      n && ((t.pos = n.pos), (t.len = n.len));
                    }
                    var i = this.app.workspace.config.zoom,
                      o = this.app.data.selection.selContext.isInHeaderFooter,
                      r =
                        this.app.data.selection.selContext
                          .headerfooterLayoutIndex;
                    void 0 !== t.idx &&
                      t.docType !== I.DOC_TYPE.main &&
                      (this.app.data.selection.selContext.setInHeaderFooterPurely(
                        !0
                      ),
                      this.app.data.selection.selContext.setHeaderfooterLayoutIndex(
                        t.idx
                      ));
                    var s = E.default.locate(
                      this.app.data,
                      t.pos,
                      null,
                      this.app.data.typoinfo,
                      "line"
                    );
                    return (
                      this.app.data.selection.selContext.setInHeaderFooterPurely(
                        o
                      ),
                      this.app.data.selection.selContext.setHeaderfooterLayoutIndex(
                        r
                      ),
                      s && s.posY
                        ? s.posY * i
                        : (console.log("locate failure"), 0)
                    );
                  }
                  console.log("error range");
                },
              },
              {
                key: "getPosBySelection",
                value: function () {
                  var e = this.app.data,
                    t = e.selection,
                    n = e.typoinfo,
                    i = this.app.workspace.config.zoom,
                    a = void 0;
                  if (t.selContext.isInComment())
                    if (this.hasTempComment)
                      this.tempRange &&
                        (a = n.getPosition(this.tempRange.pos).pos);
                    else {
                      var o = t.getNormalRange(),
                        r = this.app.data.doc.commentBodys.getCommentByPos(
                          o.pos
                        );
                      if (r) a = n.getPosition(r.pos).pos;
                      else {
                        var s = this.app.data.doc.getSubDocRange(0).len;
                        o.pos <= s && (a = n.getPosition(o.pos).pos);
                      }
                    }
                  else {
                    var d = t.selInfo.getTableMultipleSelectLastLinePos();
                    (a = t.begin.pos),
                      d
                        ? (a = n.getPosition(d.pos).pos)
                        : t.begin.position > t.end.position && (a = t.end.pos);
                  }
                  return a && a.posY
                    ? a.posY * i
                    : (console.log("locate failure"), 0);
                },
              },
              {
                key: "getRevisionAndCommentData",
                value: function (e) {
                  var t =
                      arguments.length > 1 && void 0 !== arguments[1]
                        ? arguments[1]
                        : {},
                    n = t.includeRevision,
                    i = void 0 === n || n,
                    a = t.includeComment,
                    o = void 0 === a || a,
                    r = i ? Object(R.b)(this.app.data, e.pos, 0) : [];
                  r = r.filter(this.checkIsItemVisible.bind(this));
                  var s = o
                    ? this.app.data.doc.commentBubbles.getBubbleByRange(
                        e.pos,
                        e.len
                      )
                    : null;
                  if (r.length > 0) {
                    var d =
                      !s ||
                      r.some(function (e) {
                        var t = e.range;
                        return (
                          t.pos > s.range.pos &&
                          t.pos + t.len < s.range.pos + s.range.len
                        );
                      });
                    if (d)
                      return { type: I.CR_TYPE.revision, range: e, data: r };
                  }
                  return o && s && !Object(D.isRefusalToAppeal)(s.comment_id)
                    ? s
                    : null;
                },
              },
              {
                key: "getLeft",
                value: function () {
                  if (this.app.isWebMode())
                    return (
                      (this.app.data.typoinfo.viewOffset.x +
                        this.app.data.typoinfo.width) *
                        this.workspace.config.zoom +
                      this.app.workspace.getZoomDiff() +
                      26
                    );
                  var e = (this.app.data.typoinfo.outer_rects || []).map(
                      function (e) {
                        return e.left + e.width;
                      }
                    ),
                    t = Math.max.apply(Math, r()(e)),
                    n = this.app.workspace.getZoomDiff();
                  return t * this.workspace.config.zoom + n + 26;
                },
              },
              {
                key: "setLeft",
                value: function () {
                  var e = this.rcHandler.renderHandler._element;
                  if (e) {
                    var t = void 0,
                      n = void 0,
                      i = this.app.workspace;
                    if (this.app.isWebMode()) {
                      t =
                        (this.app.data.typoinfo.viewOffset.x +
                          this.app.data.typoinfo.width) *
                          this.workspace.config.zoom +
                        this.app.workspace.getZoomDiff() +
                        26;
                    } else {
                      var a = this.app.data.typoinfo.outer_rects;
                      if (window.rightToLeft) {
                        var o = a.map(function (e) {
                          return e.left;
                        });
                        n = Math.min.apply(Math, r()(o));
                        var s = i.getZoomDiff();
                        t = n * i.config.zoom + s - 26 - e.clientWidth;
                      } else {
                        var d = a.map(function (e) {
                          return e.left + e.width;
                        });
                        n = Math.max.apply(Math, r()(d));
                        var l = i.getZoomDiff();
                        t = n * i.config.zoom + l + 26;
                      }
                    }
                    e.style.left = t + "px";
                  }
                },
              },
              {
                key: "getHeightByElement",
                value: function (e) {
                  var t =
                      arguments.length > 1 && void 0 !== arguments[1]
                        ? arguments[1]
                        : 0,
                    n = document.querySelector(".cr_modal_" + e);
                  return n ? n.offsetHeight : t;
                },
              },
              {
                key: "getHeight",
                value: function (e) {
                  var t = this.dataIdObj[e];
                  return this.checkIsItemVisible(t)
                    ? t
                      ? t.type !== I.CR_TYPE.comments || t.isHeightValid
                        ? t.height
                        : this.getHeightByElement(e, t.height)
                      : this.getHeightByElement(e)
                    : 0;
                },
              },
              {
                key: "getPos",
                value: function (e) {
                  var t = this.dataIdObj[e];
                  if (t) return t.truePos;
                  var n = document.querySelector(".cr_modal_" + e);
                  return (
                    parseInt(n.style.top) +
                    parseInt(n.style.transform.match(/,\W?(\d+)/)[1])
                  );
                },
              },
              {
                key: "currItemId",
                get: function () {
                  return this._currItemId;
                },
                set: function (e) {
                  (this._prevItemId = this._currItemId), (this._currItemId = e);
                },
              },
              {
                key: "isReEditingComment",
                get: function () {
                  return (
                    this.reEditCommentId &&
                    this.reEditCommentId === this.tempCommentId
                  );
                },
              },
            ]),
            e
          );
        })(),
        B = n(29),
        H = n.n(B),
        N = n(718),
        L = n(28),
        V = n(742),
        F = n(6156),
        j = n(636),
        U = window.rightToLeft ? "right" : "left",
        Y = (function () {
          function e(t, n, i) {
            var a = this;
            u()(this, e),
              (this.onEnterComment = function () {
                a.update();
              }),
              (this.onExitComment = function () {
                a.update();
              }),
              (this.workspace = t),
              (this.app = n),
              (this.visible = !1),
              (this.container = i),
              (this.showCommentsTip = this.showCommentsTip.bind(this)),
              (this.openCommentsByBtn = this.openCommentsByBtn.bind(this)),
              (this.doNormalOpenDialog = this.doNormalOpenDialog.bind(this)),
              (this.setInRestrictEditMode =
                this.setInRestrictEditMode.bind(this)),
              (this.update = this.update.bind(this)),
              this.bindEvents(),
              (this._element = Object(N.createElement)({
                type: "div",
                style:
                  "position: absolute; top: 0; " +
                  U +
                  ": 0; overflow: visible;",
                parent: this.container,
                classname: "comments-wrap",
              })),
              this.update();
          }
          return (
            m()(e, [
              {
                key: "clearAll",
                value: function () {
                  this.unbindEvents(),
                    window.APP.frontUtil.ReactDom.unmountComponentAtNode(
                      this._element
                    );
                },
              },
              {
                key: "bindEvents",
                value: function () {
                  window.addEventListener(
                    C.default.names.DOC_SELECTION_CHANGED,
                    this.update
                  ),
                    window.addEventListener(
                      C.default.names.DOC_WORKSPACE_AFTER_RESIZE,
                      this.update
                    ),
                    window.addEventListener(
                      C.default.comments.ON_ENTER_COMMENT_BODY,
                      this.onEnterComment
                    ),
                    window.addEventListener(
                      C.default.comments.ON_EXIT_COMMENT_BODY,
                      this.onExitComment
                    ),
                    window.addEventListener(
                      C.default.comments.SHOW_COMMENTS_TIPS,
                      this.showCommentsTip
                    ),
                    window.addEventListener(
                      C.default.comments.OPEN_COMMENTS_DIALOG_BY_BTN,
                      this.openCommentsByBtn
                    ),
                    window.addEventListener(
                      C.default.comments.OPEN_COMMENTS_DIALOG,
                      this.doNormalOpenDialog
                    ),
                    window.addEventListener(
                      C.default.restrictEdit.ON_RESTRICT_STATE_CHANGE,
                      this.setInRestrictEditMode
                    );
                },
              },
              {
                key: "unbindEvents",
                value: function () {
                  window.removeEventListener(
                    C.default.names.DOC_SELECTION_CHANGED,
                    this.update
                  ),
                    window.removeEventListener(
                      C.default.comments.ON_ENTER_COMMENT_BODY,
                      this.onEnterComment
                    ),
                    window.removeEventListener(
                      C.default.comments.ON_EXIT_COMMENT_BODY,
                      this.onExitComment
                    ),
                    window.removeEventListener(
                      C.default.names.DOC_WORKSPACE_AFTER_RESIZE,
                      this.update
                    ),
                    window.removeEventListener(
                      C.default.comments.SHOW_COMMENTS_TIPS,
                      this.showCommentsTip
                    ),
                    window.removeEventListener(
                      C.default.comments.OPEN_COMMENTS_DIALOG_BY_BTN,
                      this.openCommentsByBtn
                    ),
                    window.removeEventListener(
                      C.default.comments.OPEN_COMMENTS_DIALOG,
                      this.doNormalOpenDialog
                    ),
                    window.removeEventListener(
                      C.default.restrictEdit.ON_RESTRICT_STATE_CHANGE,
                      this.setInRestrictEditMode
                    );
                },
              },
              {
                key: "setInRestrictEditMode",
                value: function (e) {
                  this.update();
                },
              },
              {
                key: "showCommentsTip",
                value: function (e) {
                  (this.visible = e.detail.checked), this.update();
                },
              },
              {
                key: "getRangePos",
                value: function (e) {
                  var t = e.posY + (e.height - 20) / 2,
                    n = e.layoutIndex;
                  if (this.app.isWebMode()) {
                    var i = this.app.data.typoinfo;
                    return { left: i.width, top: (t -= i.viewOffset.y) };
                  }
                  var a = this.app.data.typoinfo.getLayoutPageCache(n);
                  return a ? { left: a.outer_rect.right, top: t } : null;
                },
              },
              {
                key: "openCommentsByBtn",
                value: function () {
                  this.openDialog();
                },
              },
              {
                key: "doNormalOpenDialog",
                value: function () {
                  this.openDialog();
                },
              },
              {
                key: "openDialog",
                value: function () {
                  if (Object(j.isReadingMode)())
                    return Object(j.closeReadingMode)(), !1;
                  this.app.functionStatus.comment.disabled ||
                    Object(F.checkHasCommentPermission)()
                      .then(function () {
                        L.isIPad && Object(V.focusOnOtherInput)();
                        var e = window.APP.appApi.getCommentShowStatus(),
                          t = e.commentPanel,
                          n = e.commentBubble;
                        t
                          ? C.default.dispatchEvent(
                              C.default.comments.GO_TO_ALL_COMMENT_PANEL
                            )
                          : n ||
                            (window.APP.appApi.showComments({ checked: !0 }),
                            window.APP.appApi.setCommentShowStatus({
                              commentBubble: !0,
                            })),
                          C.default.dispatchEvent(
                            C.default.comments.ON_ADD_ITEM_BY_BTN
                          );
                      })
                      .catch(F.goToApplyForPermission);
                },
              },
              {
                key: "resize",
                value: function () {
                  this.update();
                },
              },
              {
                key: "update",
                value: function () {
                  window.APP.functionStatus.comment.updateMainTextEntryStatus();
                  var e = {
                    visible: this.visible,
                    addParams: this.buildParams(),
                  };
                  this.render(e);
                },
              },
              {
                key: "isSelectionAllBreak",
                value: function (e) {
                  for (
                    var t = e || this.app.data.selection.getNormalRange(),
                      n = t.pos,
                      i = t.len,
                      a = !0,
                      o = n;
                    o < n + i;
                    o++
                  )
                    if (!this.docUserCommentsHandle.isCharBreak(o)) {
                      a = !1;
                      break;
                    }
                  return a;
                },
              },
              {
                key: "buildParams",
                value: function () {
                  var e = this.app.data,
                    t = e.selection,
                    n = e.typoinfo,
                    i = t.getNormalRange().pos,
                    a = t.begin.pos;
                  if (this.app.data.doc.getSubDocType(i) !== k.MainText)
                    a = null;
                  else {
                    var o =
                      t.selInfo &&
                      t.selInfo.getTableMultipleSelectLastLinePos();
                    o
                      ? (a = n.getPosition(o.pos).pos)
                      : t.begin.position > t.end.position && (a = t.end.pos);
                  }
                  return {
                    addPos: this.getAddPos(a),
                    btnVisible:
                      this.app.functionStatus.comment.entryButtonInMainText
                        .visible &&
                      !this.app.functionStatus.comment.entryInShape.visible,
                    beTop: !0,
                  };
                },
              },
              {
                key: "updateAddPos",
                value: function () {
                  this.update();
                },
              },
              {
                key: "getAddPos",
                value: function (e) {
                  if (!e) return { top: -100, left: -100 };
                  var t = this.getRangePos(e);
                  if (t) {
                    var n = t.left,
                      i = t.top;
                    return H()({ top: Math.round(i) }, U, Math.round(n));
                  }
                  return { top: -100, left: -100 };
                },
              },
              {
                key: "render",
                value: function (e) {
                  var t = JSON.stringify(e);
                  (this._preProps && this._preProps === t) ||
                    ((this._preProps = t),
                    window.APP.frontUtil.ReactDom.render(
                      window.APP.frontUtil.CommentsTip(e),
                      this._element
                    ));
                },
              },
              {
                key: "docUserCommentsHandle",
                get: function () {
                  return this.app.services.userCommentsManager
                    .docUserCommentsHandle;
                },
              },
            ]),
            e
          );
        })(),
        W = n(3277),
        $ = n(14488),
        G = n.n($),
        z = n(3512),
        J = n(1446),
        q = n(4440),
        X = n.n(q),
        Z = n(1954),
        Q = n(1967),
        K = "http://www.w3.org/2000/svg",
        ee = window.APP.data.selection,
        te = window.APP.data.doc,
        ne = window.APP.data.doc.viewSettings,
        ie = (function () {
          function e(t, n, i, a) {
            var o = this;
            u()(this, e),
              (this._handleRevisionSettingsChange = function (e) {
                [
                  { key: "revisionsView", clearPositionCache: !0 },
                  { key: "showMark", clearPositionCache: !0 },
                  { key: "showRevisionsLine", clearPositionCache: !1 },
                ].some(function (t) {
                  var n = t.key,
                    i = t.clearPositionCache,
                    a = e.detail[n],
                    r = o._getPrevData("revisionSetting")[n];
                  if (void 0 !== a && a !== r)
                    return (
                      o._setPrevData("revisionSetting", H()({}, n, a)),
                      i && o._positionCache.clear(),
                      o.render(o._getPrevData("render").viewData, !0),
                      !0
                    );
                });
              }),
              (this.app = t),
              (this.container = n),
              (this.rcHandler = i),
              (this.rcDataHandler = a),
              (this._lineMap = new Map()),
              (this._dirtySet = new Set()),
              (this._positionCache = new Map()),
              this._setup(),
              this._bindEvents(),
              this._initPrevData();
          }
          return (
            m()(e, [
              {
                key: "resize",
                value: function () {
                  var e =
                      arguments.length > 0 && void 0 !== arguments[0]
                        ? arguments[0]
                        : {},
                    t = e.width,
                    n = void 0 === t ? this._size.width : t,
                    i = e.height,
                    a = void 0 === i ? this._size.height : i;
                  ae(this.svg, {
                    width: n,
                    height: a,
                    viewBox: "0 0 " + n + " " + a,
                  });
                },
              },
              {
                key: "render",
                value: function () {
                  var e = this,
                    t =
                      arguments.length > 0 && void 0 !== arguments[0]
                        ? arguments[0]
                        : this.rcDataHandler.getViewData(!0),
                    n =
                      arguments.length > 1 &&
                      void 0 !== arguments[1] &&
                      arguments[1];
                  if (this.rcHandler.isRevisionVisible)
                    if (ne.getRevisionsLineShow()) {
                      var i = this._shouldUpdate(t) || n;
                      if (i) {
                        n && this._positionCache.clear(),
                          this._markDirtyLines();
                        var a = this._processRevisionViewData(t),
                          o = this._groupByLine(a),
                          r = this._rcContainerLeft;
                        o.forEach(function (t) {
                          t.forEach(function (n, i) {
                            var a = i === t.length - 1 ? null : t[i + 1];
                            e._renderLine({
                              lineRevisionData: n,
                              nextLineRevisionData: a,
                              rcContainerLeft: r,
                            });
                          });
                        }),
                          this._removeDirtyLines();
                      }
                    } else {
                      if ((this._removeAllLines(), !this._getActiveId()))
                        return;
                      var s = t.data.find(function (t) {
                        return (
                          t.id === e._getActiveId() && "comments" !== t.type
                        );
                      });
                      if (!s) return;
                      var d = this._getLineRevisionData(s);
                      this._renderLine({
                        lineRevisionData: d,
                        isForceActive: !0,
                      });
                    }
                  else this._removeAllLines();
                },
              },
              {
                key: "toggleHighlightLine",
                value: function (e, t) {
                  if (!this._isRevisionActive(e.id)) {
                    var n = this._getLineRevisionData(e);
                    this._renderLine({ lineRevisionData: n, isForceActive: t });
                  }
                },
              },
              {
                key: "clearAll",
                value: function () {
                  this._unBindEvents();
                },
              },
              {
                key: "onSelectionChanged",
                value: function () {
                  this.render();
                },
              },
              {
                key: "_setup",
                value: function () {
                  var e = this._size,
                    t = e.width,
                    n = e.height,
                    i = Object(N.createElement)({
                      type: "div",
                      id: "revision-lines",
                      style: {
                        pointerEvents: "none",
                        position: "absolute",
                        top: 0,
                        left: 0,
                        width: t,
                        height: n,
                        zIndex: 1,
                      },
                    });
                  (this.svg = Object(N.createElementNS)({
                    namespaceURI: K,
                    type: "svg",
                    attributes: {
                      width: t,
                      height: n,
                      overflow: "visible",
                      viewBox: "0 0 " + t + " " + n,
                    },
                  })),
                    i.appendChild(this.svg),
                    this.container.appendChild(i);
                },
              },
              {
                key: "_bindEvents",
                value: function () {
                  window.addEventListener(
                    C.default.revision.REVISION_SETTINGS_CHANGE,
                    this._handleRevisionSettingsChange
                  );
                },
              },
              {
                key: "_unBindEvents",
                value: function () {
                  window.removeEventListener(
                    C.default.revision.REVISION_SETTINGS_CHANGE,
                    this._handleRevisionSettingsChange
                  );
                },
              },
              {
                key: "_initPrevData",
                value: function () {
                  this._prevData = {
                    render: {
                      viewData: void 0,
                      zoom: this.app.workspace.config.zoom,
                      workspaceWidth:
                        this.app.workspace.element.cacheDOMAttr.clientWidth,
                      activeId: this._getActiveId(),
                    },
                    revisionSetting: {
                      revisionsView:
                        this.app.data.doc.viewSettings.getRevisionsView(),
                      showMark:
                        this.app.data.doc.viewSettings.getRevisionsShowMarkup(),
                      showRevisionsLine:
                        this.app.data.doc.viewSettings.getRevisionsLineShow(),
                    },
                  };
                },
              },
              {
                key: "_getActiveId",
                value: function () {
                  return this.rcDataHandler.currItemId;
                },
              },
              {
                key: "_getPrevData",
                value: function (e) {
                  return this._prevData[e];
                },
              },
              {
                key: "_setPrevData",
                value: function (e, t) {
                  this._prevData[e] = a()({}, this._prevData[e], t);
                },
              },
              {
                key: "_processRevisionViewData",
                value: function (e) {
                  for (
                    var t = { data: [], ranges: [], tops: [] }, n = 0;
                    n < e.length;
                    n++
                  ) {
                    var i = e.data[n],
                      a = e.ranges[n],
                      o = e.tops[n];
                    "comments" !== i.type &&
                      i.range.pos <= te.getDocMaxSize() &&
                      (t.data.push(i), t.ranges.push(a), t.tops.push(o));
                  }
                  return t;
                },
              },
              {
                key: "_shouldUpdate",
                value: function (e) {
                  var t = this._getPrevData("render"),
                    n = t.viewData,
                    i = t.zoom,
                    a = t.workspaceWidth,
                    o = t.activeId;
                  this._setPrevData("render", { viewData: e });
                  var r = (n || {}).tops || [],
                    s = (e || {}).tops || [];
                  if (r.length !== s.length) return !0;
                  var d = (n || {}).ranges || [],
                    l = (e || {}).ranges || [];
                  if (
                    r.some(function (e, t) {
                      return Math.round(e) !== Math.round(s[t]);
                    }) ||
                    d.some(function (e, t) {
                      return JSON.stringify(e) !== JSON.stringify(l[t]);
                    })
                  )
                    return !0;
                  var u = this.app.workspace.config.zoom;
                  if (i !== u)
                    return this._setPrevData("render", { zoom: u }), !0;
                  var c = this.app.workspace.element.cacheDOMAttr.clientWidth;
                  if (a !== c)
                    return (
                      this._setPrevData("render", { workspaceWidth: c }),
                      this._positionCache.clear(),
                      !0
                    );
                  var m = this._getActiveId();
                  return (
                    o !== m &&
                    (this._setPrevData("render", { activeId: m }), !0)
                  );
                },
              },
              {
                key: "_groupByLine",
                value: function (e) {
                  var t = this,
                    n = new Map();
                  return (
                    e.data
                      .sort(function (e, t) {
                        return (
                          e.range.pos +
                          e.range.len -
                          (t.range.pos + t.range.len)
                        );
                      })
                      .forEach(function (e) {
                        var i = t._getLineRevisionData(e),
                          a = i.position,
                          o = a.posY,
                          r = a.line,
                          s = Math.round(o + t._getUnderlineYPos(r));
                        n.has(s) ? n.get(s).push(i) : n.set(s, [i]);
                      }),
                    n
                  );
                },
              },
              {
                key: "_getLineRevisionData",
                value: function (e) {
                  var t = e.position,
                    n = e.id,
                    i = e.userId,
                    a = e.userID,
                    o = e.pageIndex,
                    r = e.range;
                  return {
                    top: t.top,
                    id: n,
                    userId: i || a,
                    pageIndex: o,
                    position: this._getPosition({ range: r, id: n }),
                  };
                },
              },
              {
                key: "calculatePageIntersection",
                value: function (e, t, n) {
                  var i = e.x,
                    a = e.y,
                    o = t.x,
                    r = t.y;
                  if (n < Math.min(a, r) || n > Math.max(a, r)) return null;
                  return i === o
                    ? { x: i, y: n }
                    : { x: (n - a) / ((r - a) / (o - i)) + i, y: n };
                },
              },
              {
                key: "_renderLine",
                value: function (e) {
                  var t = e.lineRevisionData,
                    n = e.nextLineRevisionData,
                    i = e.rcContainerLeft,
                    o = void 0 === i ? this._rcContainerLeft : i,
                    r = e.isForceActive,
                    s = void 0 !== r && r,
                    d = t.top,
                    l = t.id,
                    u = t.userId,
                    c = t.pageIndex,
                    m = t.position;
                  if (this.app.data.typoinfo.layout_pages[c]) {
                    var p = this._getStartPoint(m),
                      h = n ? this._getStartPoint(n.position) : null,
                      f = this.app.isWebMode() ? 0 : c,
                      v = {
                        x: o + 4,
                        y: d - (this.rcDataHandler.scrollTop[f] || 0) + 1,
                      },
                      g = { x: this._getBreakPointX(c), y: p.y },
                      w = ee.selCoop.getRevisionColor(u),
                      b = this._isRevisionActive(l) || s;
                    b && !s && (v.y += 1);
                    var C = this.rcHandler.getPageRect(c);
                    if (C) {
                      var y = C.top,
                        I = C.top + C.height;
                      if (y > v.y) {
                        var _ = this.calculatePageIntersection(g, v, y);
                        _ && Object.assign(v, _);
                      } else if (I < v.y) {
                        var E = this.calculatePageIntersection(g, v, I);
                        E && Object.assign(v, E);
                      }
                    } else Object.assign(v, g);
                    var T = this._getOrCreateLine(l);
                    (T.revisionData = t),
                      (T.nextRevisionData = n),
                      ae(
                        T.svg,
                        h && !b
                          ? a()(
                              {
                                d:
                                  "M " +
                                  p.x +
                                  " " +
                                  p.y +
                                  " H " +
                                  h.x +
                                  " M " +
                                  g.x +
                                  " " +
                                  g.y +
                                  " L " +
                                  v.x +
                                  " " +
                                  v.y,
                                fill: "none",
                                stroke: w,
                                "stroke-linejoin": "round",
                              },
                              this._getLineActiveAttributes(b, s)
                            )
                          : a()(
                              {
                                d:
                                  "M " +
                                  p.x +
                                  " " +
                                  p.y +
                                  " H " +
                                  g.x +
                                  " L " +
                                  v.x +
                                  " " +
                                  v.y,
                                fill: "none",
                                stroke: w,
                                "stroke-linejoin": "round",
                              },
                              this._getLineActiveAttributes(b, s)
                            )
                      ),
                      this._dirtySet.delete(l);
                  }
                },
              },
              {
                key: "_getStartPoint",
                value: function (e) {
                  var t = e.posX,
                    n = e.posY,
                    i = e.line,
                    a = function (e) {
                      return Math.round(e - 0.5);
                    };
                  return {
                    x: this._transformX(a(t)),
                    y: this._transformY(a(n + this._getUnderlineYPos(i))),
                  };
                },
              },
              {
                key: "_getPosition",
                value: function (e) {
                  var t = e.range,
                    n = e.id,
                    i = JSON.stringify(t),
                    a = this._positionCache.get(n);
                  if (a && a.positionKey === i) return a.position;
                  var o = ee.selContext.isInHeaderFooter,
                    r = ee.selContext.headerfooterLayoutIndex,
                    s = void 0 !== t.idx && t.docType !== I.DOC_TYPE.main;
                  s &&
                    (ee.selContext.setInHeaderFooterPurely(!0),
                    ee.selContext.setHeaderfooterLayoutIndex(t.idx));
                  var d = t.pos,
                    l = this.app.data.typoinfo.getPosition(d).pos;
                  return (
                    s &&
                      (ee.selContext.setInHeaderFooterPurely(o),
                      ee.selContext.setHeaderfooterLayoutIndex(r)),
                    this._positionCache.set(n, { positionKey: i, position: l }),
                    l
                  );
                },
              },
              {
                key: "_getUnderlineYPos",
                value: function (e) {
                  var t = 0;
                  return (
                    e.underlineInfos &&
                      e.underlineInfos[0] &&
                      (t = e.underlineInfos[0].yPos - e.rect.top),
                    (e.baseline || 0) + t + Q.w
                  );
                },
              },
              {
                key: "_transformX",
                value: function (e) {
                  return (
                    e * this.app.workspace.config.zoom +
                    this.app.workspace.getZoomDiff()
                  );
                },
              },
              {
                key: "_transformY",
                value: function (e) {
                  return e * this.app.workspace.config.zoom;
                },
              },
              {
                key: "_getLineActiveAttributes",
                value: function (e, t) {
                  var n = ne.getRevisionsLineShow() || e ? "visible" : "hidden",
                    i = this.app.workspace.config.zoom;
                  return e
                    ? {
                        "stroke-dasharray": "",
                        "stroke-width": (t ? 1 : 2) * i,
                        opacity: t ? 0.5 : 1,
                        visibility: n,
                      }
                    : {
                        "stroke-dasharray": 3 * i + "," + 3 * i,
                        "stroke-width": 1 * i,
                        opacity: 0.2,
                        visibility: n,
                      };
                },
              },
              {
                key: "_markDirtyLines",
                value: function () {
                  var e = this;
                  this._lineMap.forEach(function (t, n) {
                    e._dirtySet.add(n);
                  });
                },
              },
              {
                key: "_removeDirtyLines",
                value: function () {
                  var e = this;
                  this._dirtySet.forEach(function (t) {
                    var n = e._lineMap.get(t).svg;
                    e.svg.removeChild(n), e._lineMap.delete(t);
                  }),
                    this._dirtySet.clear();
                },
              },
              {
                key: "_removeAllLines",
                value: function () {
                  (this.svg.innerHTML = ""),
                    this._lineMap.clear(),
                    this._positionCache.clear();
                },
              },
              {
                key: "_getOrCreateLine",
                value: function (e) {
                  if (this._lineMap.has(e)) return this._lineMap.get(e);
                  var t = Object(N.createElementNS)({
                      namespaceURI: K,
                      type: "path",
                    }),
                    n = { svg: t };
                  return this.svg.appendChild(t), this._lineMap.set(e, n), n;
                },
              },
              {
                key: "_isRevisionActive",
                value: function (e) {
                  return e === this._getActiveId();
                },
              },
              {
                key: "_getBreakPointX",
                value: function (e) {
                  var t = void 0;
                  if (this.app.isWebMode()) {
                    var n = this.app.data.typoinfo,
                      i = n.viewOffset,
                      a = n.width,
                      o = n.horizontalPadding;
                    t = i.x + a - o;
                  } else {
                    var r = this.app.data.typoinfo.layout_pages[e];
                    t = r.outer_rect.left + r.inner_rect.right;
                  }
                  return this._transformX(t);
                },
              },
              {
                key: "_size",
                get: function () {
                  return {
                    width:
                      this.app.workspace.container.cacheDOMAttr.scrollWidth,
                    height:
                      this.app.workspace.container.cacheDOMAttr.clientHeight,
                  };
                },
              },
              {
                key: "_rcContainerLeft",
                get: function () {
                  return this.rcDataHandler.getLeft();
                },
              },
            ]),
            e
          );
        })();
      function ae(e, t) {
        for (var n in t) t.hasOwnProperty(n) && e.setAttribute(n, t[n]);
      }
      var oe = n(4057),
        re = n(4673),
        se = (function (e) {
          function t(e, n, i, a) {
            var o = this;
            u()(this, t);
            var s,
              l,
              c,
              m,
              p,
              f,
              v,
              g,
              w,
              b,
              y,
              _,
              E,
              T = h()(
                this,
                (t.__proto__ || Object.getPrototypeOf(t)).call(this, e, n, i)
              );
            return (
              (T.updateCommentStatus = function () {
                T.getAllDataDraw(), T.update();
              }),
              (T.onCommentShowStatusUpdate = function (e) {
                var t = e.detail.commentPanel;
                (T.revisionVisibleStatus = !t && T.isRevisionVisible),
                  t ? T.unbindDynamicEvents() : T.bindDynamicEvents();
              }),
              (T.handleRestrictEditModeChange = function (e) {
                var t = e.detail,
                  n = t.isFormProtect,
                  i = t.isReadonlyProtect;
                (n || i) &&
                  T.dataHandler.hasTempComment &&
                  T.commitTempComment({
                    callback: function (e) {
                      e ||
                        T.discardTempComment({
                          isResetElements: !0,
                          isUpdatePosition: !0,
                          isResetContext: !0,
                        });
                    },
                  });
              }),
              (T.revisionAcceptRefuse = function (e) {
                console.error("❤ 修订拒绝接受前端处理", e);
                var t = e.detail,
                  n = t.id,
                  i = t.type;
                if (n) {
                  var a = T.app.data.doc.revisions.getRevisionById(n);
                  a && a[i] && a[i](),
                    T.dataHandler.ModifyModalToFitPart(n, !0);
                }
                T.update();
              }),
              (T.activeCommentByRange = function (e) {
                var t = e.detail,
                  n = t.range,
                  i = t.type;
                if (n)
                  if ("bookmark" !== i) {
                    var a = T.app.data.doc.commentBubbles.getBubbleByRange(
                      n.pos,
                      n.len
                    );
                    if (a) {
                      var o = void 0,
                        r = void 0;
                      a.range
                        ? ((o = a.range.pos), (r = a.range.len))
                        : ((o = a.pos), (r = a.len)),
                        T.onActive({ pos: o, len: r }, a.id, a);
                    }
                  } else T.openModalByRange(n);
              }),
              (T.inactiveComment = function () {
                T.onClose(!1);
              }),
              (T.openModalByRange = function (e) {
                if (
                  T.isCommentBubbleStatus &&
                  !T.dataHandler.hasTempComment &&
                  !T.dataHandler.hasTempComment
                ) {
                  if (
                    T.selectionCache &&
                    void 0 !== T.selectionCache.pos &&
                    void 0 !== T.selectionCache.len &&
                    T.selectionCache.pos === e.pos &&
                    T.selectionCache.len === e.len
                  )
                    return !1;
                  var t = T.dataHandler.getRevisionAndCommentData(e, {
                    includeRevision: T.isRevisionVisible,
                    includeComment:
                      T.app.commentShowStatus.commentBubble &&
                      T.app.isCommentEnabled,
                  });
                  if (!t || 0 === t.data.length)
                    return T.dataHandler.currItemId && T.onClose(!0), !1;
                  var n = t.type === I.CR_TYPE.revision,
                    i = t.type === I.CR_TYPE.comments;
                  t = n ? t.data[t.data.length - 1] : t;
                  var a = i ? t.id : t.rc_id;
                  if (
                    (a &&
                      !T.dataHandler.dataIdObj[a] &&
                      T.dataHandler.BuildSingleData(t),
                    (t = T.dataHandler.dataIdObj[a]) &&
                      (T.commentVisible &&
                        !T.dataHandler.data.find(function (e) {
                          return e.id === t.id;
                        }) &&
                        (T.dataHandler.data.unshift(t),
                        T.dataHandler.setModalVisibleById(null)),
                      (T.selectionCache = e),
                      T.activeRender({
                        range: t.range,
                        id: t.id,
                        focus: !1,
                        data: t,
                        cb: null,
                        type: "point",
                      }),
                      !T.checkAndAdjustBubblePosition(t).isVisible))
                  ) {
                    var o = T.calculateScrollTop(t),
                      r = o.pageIndex,
                      s = o.srcollTop;
                    C.default.dispatchEvent(C.default.comments.CR_PAGE_SCROLL, {
                      pageIndex: r,
                      scrollTop: s,
                    });
                  }
                  return (
                    window.collection(
                      "commandbar",
                      "click",
                      "comment_card_textarea"
                    ),
                    !0
                  );
                }
              }),
              (T.insertTempComment =
                ((s = d()(
                  regeneratorRuntime.mark(function e() {
                    var t,
                      n,
                      i,
                      a,
                      r,
                      s,
                      d,
                      l,
                      u,
                      c,
                      m,
                      p,
                      h,
                      f =
                        arguments.length > 0 && void 0 !== arguments[0]
                          ? arguments[0]
                          : {};
                    return regeneratorRuntime.wrap(
                      function (e) {
                        for (;;)
                          switch ((e.prev = e.next)) {
                            case 0:
                              if (!T.isMakingComment) {
                                e.next = 2;
                                break;
                              }
                              return e.abrupt("return", !1);
                            case 2:
                              return (
                                (T.isMakingComment = !0),
                                (t = T.app.data),
                                (n = t.selection),
                                (i = t.doc),
                                (a = f.range) ||
                                  (f.bubbleId
                                    ? (r = i.commentBubbles.getBubbleById(
                                        f.bubbleId
                                      )) && (a = { pos: r.pos, len: r.len })
                                    : f.replyId &&
                                      (s = i.comments.getCommentByCommentId(
                                        f.replyId
                                      )) &&
                                      (a = { pos: s.pos, len: s.len }),
                                  a ||
                                    (n.selContext.isInComment()
                                      ? ((a =
                                          T.dataHandler.getCurrentCommentRange()),
                                        T.app.uilManager.exitCommentBody())
                                      : ((a = n.getNormalRange()),
                                        (d =
                                          T.app.data.doc.commentBubbles.getBubbleByRange(
                                            a.pos,
                                            a.len
                                          )) &&
                                          d.data &&
                                          d.data.length > 0 &&
                                          (a = d.range),
                                        0 !== a.len &&
                                          T.docUserCommentsHandle.isLineBreak(
                                            a.pos + a.len - 1
                                          ) &&
                                          a.len--))),
                                (l =
                                  T.app.data.doc.commentBubbles.getBubbleByRange(
                                    a.pos,
                                    a.len
                                  )),
                                (T.dataHandler.tempCommentId = I.TEMP),
                                (u = !1),
                                (c = I.TEMP),
                                (m = I.TEMP),
                                (p = I.TEMP),
                                l &&
                                  T.commentVisible &&
                                  (h =
                                    T.app.data.doc.commentBubbles.getBubbleById(
                                      l.id
                                    )) &&
                                  ((c = h.id),
                                  (a.pos = h.pos),
                                  (a.len = h.len)),
                                T.dataHandler.setTempCommentBubble({
                                  bubbleId: c,
                                  rcId: m,
                                  replyId: f.replyId,
                                  range: a,
                                  commentId: p,
                                  isNotifyTempComment: !0,
                                }),
                                C.default.dispatchEvent(
                                  C.default.comments.ON_INSERT_TEMP_COMMENT
                                ),
                                T.getAllDataDraw(),
                                T.setActive(a, c, !0, null, null, !1, !0),
                                (u = !0),
                                (T.isMakingComment = !1),
                                e.abrupt("return", u)
                              );
                            case 20:
                            case "end":
                              return e.stop();
                          }
                      },
                      e,
                      o
                    );
                  })
                )),
                function () {
                  return s.apply(this, arguments);
                })),
              (T.commitAndInsertNewTempComment = function () {
                return (
                  T.commitTempComment({
                    resetNow: !1,
                    callback: function (e) {
                      T.app.editor.closeLastTransact(),
                        L.isIPad && Object(V.focusOnOtherInput)();
                      var t = T.app.data.doc.commentBubbles.getBubbleByRange(
                        e.pos,
                        e.len
                      );
                      t &&
                        T.openCommentsModalByRange({
                          pos: t.range.pos,
                          len: t.range.len,
                        });
                    },
                  }),
                  !0
                );
              }),
              (T.insertCommentMethod = function (e, t) {
                var n = void 0;
                switch (e) {
                  case "Emoji":
                    n = T.insertEmojiComment.bind(T, t.detail);
                    break;
                  case "Modal":
                  default:
                    n = T.openCommentsModalByRange.bind(T);
                }
                if (n) {
                  var i = T.docUserCommentsHandle.getCommentRange(),
                    a = T.app.data.selection;
                  if (a.begin.position !== a.end.position) n(i);
                  else {
                    var o = a.end.pos,
                      r = o.posX,
                      s = o.posY,
                      d = T.app.uilManager.hit({ pos: { x: r + 1, y: s + 1 } }),
                      l = !1;
                    if (d.catalogInfos) return void n(i);
                    var u = !1;
                    if (d && d.position < d.line.range.end - 1) {
                      try {
                        u = d.ctrlInfos[0].isDate;
                      } catch (e) {}
                      u ||
                        (l = a.selAlter.extendSelectBlock(d, function (e) {
                          e &&
                            (T.adjustCommentRange(),
                            (i = T.docUserCommentsHandle.getCommentRange()),
                            n(i));
                        }));
                    }
                    if (!1 === l) {
                      if (
                        a.begin.position === a.begin.pos.line.range.begin &&
                        u
                      )
                        return void window.Toast.info(
                          _i18n(
                            "applications.writer.components.other.Comment.unableToInsertCommentHere",
                            "不支持在此处插入评论"
                          )
                        );
                      d = T.app.uilManager.hit({ pos: { x: r - 1, y: s + 1 } });
                      var c = !1;
                      try {
                        c = d.ctrlInfos[0].isDate;
                      } catch (e) {}
                      c
                        ? window.Toast.info(
                            _i18n(
                              "applications.writer.components.other.Comment.unableToInsertCommentHere",
                              "不支持在此处插入评论"
                            )
                          )
                        : a.selAlter.extendSelectBlock(d, function () {
                            T.adjustCommentRange(),
                              (i = T.docUserCommentsHandle.getCommentRange()),
                              n(i);
                          });
                    }
                  }
                }
              }),
              (T.openCommentsModal = function (e) {
                T.insertCommentMethod("Modal", e);
              }),
              (T.insertCommentByEmoji = function (e) {
                T.insertCommentMethod("Emoji", e);
              }),
              (T.insertEmojiComment =
                ((l = d()(
                  regeneratorRuntime.mark(function e(t, n) {
                    var i, a, r, s, d;
                    return regeneratorRuntime.wrap(
                      function (e) {
                        for (;;)
                          switch ((e.prev = e.next)) {
                            case 0:
                              if (
                                ((i = t.emoji_id),
                                !(a = i && Object(Z.getEmojiById)(i)))
                              ) {
                                e.next = 7;
                                break;
                              }
                              return (
                                (e.next = 5),
                                T.app.servicesLoader.commentsDataManager.addComment(
                                  n,
                                  a.unicode,
                                  null,
                                  !0,
                                  !1
                                )
                              );
                            case 5:
                              (r = e.sent) &&
                                (T.app.commentShowStatus.commentPanel &&
                                  T.app.viewUIL.typoUpdate(),
                                (s = r.range),
                                (d =
                                  T.app.data.doc.commentBubbles.getBubbleByRange(
                                    s.pos,
                                    s.len
                                  )) &&
                                  (T.app.commentShowStatus.commentBubble
                                    ? T.setActive(null, d.id, !1)
                                    : T.app.commentShowStatus.commentPanel &&
                                      C.default.dispatchEvent(
                                        C.default.comments
                                          .ACTIVE_COMMENT_PANEL_BUBBLE,
                                        { id: d.id, goFirst: !0 }
                                      )));
                            case 7:
                            case "end":
                              return e.stop();
                          }
                      },
                      e,
                      o
                    );
                  })
                )),
                function (e, t) {
                  return l.apply(this, arguments);
                })),
              (T.mentionInComment =
                ((c = d()(
                  regeneratorRuntime.mark(function e(t) {
                    var n, i, a, r;
                    return regeneratorRuntime.wrap(
                      function (e) {
                        for (;;)
                          switch ((e.prev = e.next)) {
                            case 0:
                              if (
                                ((n = t.detail), (i = n.rcId), (a = n.bubbleId))
                              ) {
                                e.next = 3;
                                break;
                              }
                              return e.abrupt("return", !1);
                            case 3:
                              if (
                                ((r =
                                  T.app.data.doc.commentBubbles.getBubbleById(
                                    a
                                  )),
                                i)
                              ) {
                                e.next = 9;
                                break;
                              }
                              return (
                                (e.next = 7),
                                T.insertTempComment({
                                  range: { pos: r.pos, len: r.len },
                                })
                              );
                            case 7:
                              return (e.next = 9), T.waitTimeout(100);
                            case 9:
                              C.default.dispatchEvent(
                                C.default.comments.ON_CLICK_OPEN_AT
                              );
                            case 10:
                            case "end":
                              return e.stop();
                          }
                      },
                      e,
                      o
                    );
                  })
                )),
                function (e) {
                  return c.apply(this, arguments);
                })),
              (T.showRevisionBubble = function (e) {
                var t = e.detail.visible;
                (T.revisionVisibleStatus = t && T.isRevisionVisible),
                  T.getAllData(),
                  T.revisionVisibleStatus ? T.setModalPos() : T.doModalToFit();
              }),
              (T.showRevisionHandle = function (e) {
                (!0 !== e && T.revisionVisibleStatus === T.isRevisionVisible) ||
                  ((T.revisionVisibleStatus = T.isRevisionVisible),
                  T.getCurrentData(),
                  T.isRevisionVisible ? T.setModalPos() : T.doModalToFit());
              }),
              (T.showCommentsHandle = function (e) {
                var t = e.detail,
                  n = t.checked,
                  i = t.isTemplate;
                (i && T.templateShowTime > 0) ||
                  (i && T.templateShowTime++,
                  (T.commentVisible = !!n),
                  T.getAllDataDraw(),
                  T.commentVisible
                    ? T.dataHandler.hasTempComment
                      ? T.doModalByIndex(
                          "point",
                          {},
                          T.dataHandler.tempBubbleId
                        )
                      : T.setModalPos()
                    : T.doModalToFit());
              }),
              (T.diffPages = function (e) {
                var t = T.app.workspace.config.zoom,
                  n = e;
                ("[object Array]" === window.utils.Lodash.getType(e) &&
                  0 !== e.length) ||
                  (n = [].concat(r()(T.app.workspace.currentUsedPage)));
                try {
                  if (t !== T.zoom) return !0;
                  if (n.length !== T.usedPage.length) return !0;
                  for (var i = 0; i < n.length; i++)
                    if (n[i] !== T.usedPage[i]) return !0;
                  return !1;
                } finally {
                  (T.usedPage = n), (T.zoom = t);
                }
              }),
              (T.beforeViewModeChanged = function (e) {
                T.dataHandler.hasTempComment &&
                  T.discardTempComment({
                    isUpdatePosition: !0,
                    isResetElements: !0,
                  });
              }),
              (T.onExitComment = function (e) {
                T.dataHandler.hasTempComment &&
                  T.commitTempComment({
                    isUpdatePosition: !1,
                    resetNow: !0,
                    callback: function (t) {
                      t || T.discardTempComment(e.detail);
                    },
                  });
              }),
              (T.onBeforeUnload = function () {
                T.dataHandler.hasTempComment &&
                  T.discardTempComment({
                    isResetContext: !0,
                    isUpdatePosition: !0,
                    isResetElements: !0,
                  });
              }),
              (T.handleUndoRedo = function (e) {
                var t = T.app.data.selection;
                switch (!0) {
                  case t.selContext.isInComment() &&
                    !T.dataHandler.hasTempComment:
                    T.restoreTempComment();
                    break;
                  case t.selContext.isInComment() &&
                    T.dataHandler.hasTempComment:
                    T.switchTempComment();
                    break;
                  case !t.selContext.isInComment() &&
                    T.dataHandler.hasTempComment:
                    T.discardTempComment({ isResetElements: !0 });
                }
              }),
              (T.viewportChange = function () {
                !T.workspace.unMount &&
                  T.isCommentBubbleStatus &&
                  (T.update(),
                  T.workspace.resizeIfNecessary(),
                  T.dataHandler.hasTempComment &&
                    T.workspace.updateCommentIndicator());
              }),
              (T.getCurPages = function () {
                var e =
                    arguments.length > 0 && void 0 !== arguments[0]
                      ? arguments[0]
                      : T.workspace.currentUsedPage,
                  t = void 0;
                t =
                  e.length &&
                  e[e.length - 1] !== T.prevPages[T.prevPages.length - 1]
                    ? [].concat(r()(e))
                    : T.prevPages;
                var n = Math.min.apply(Math, r()(t));
                1 === t.length && n > 0 && t.unshift(n - 1);
                var i = T.dataHandler.dataIdObj[T.dataHandler.currItemId];
                return (
                  i &&
                    i.pageIndex &&
                    !t.includes(i.pageIndex) &&
                    (t.push(i.pageIndex),
                    t.sort(function (e, t) {
                      return e - t;
                    })),
                  (T.prevPages = t),
                  t
                );
              }),
              (T.getCurrentData = function () {
                var e = T.getCurPages(),
                  t = T.dataHandler.getAllData(
                    e,
                    !T.commentVisible,
                    !T.revisionVisibleStatus
                  );
                return (
                  T.app.appApi.getCommentShowStatus().commentBubble &&
                    T.backfillCurr(e),
                  t
                );
              }),
              (T.getScrollData = function () {
                var e = T.getCurPages(T.usedPage);
                T.dataHandler.getAllData(
                  e,
                  !T.commentVisible,
                  !T.revisionVisibleStatus
                ),
                  T.app.appApi.getCommentShowStatus().commentBubble &&
                    T.backfillCurr(e),
                  T.update({ trigger: "scroll" }),
                  T.doModelToScroll();
              }),
              (T.getAllData = function () {
                return T.getCurrentData();
              }),
              (T.getNextData = function () {
                if (!(T.usedPageMax <= T.allUsedPageMax)) {
                  for (
                    var e = Math.max(T.usedPageMax, T.allUsedPageMax),
                      t = [],
                      n = T.allUsedPageMax + 1;
                    n <= e;
                    n++
                  )
                    t.push(n);
                  t.length > 0 &&
                    ((T.allUsedPageMax = e),
                    T.dataHandler.getStepData(
                      t,
                      !T.commentVisible,
                      !T.revisionVisibleStatus
                    ),
                    T.doInsertData());
                }
              }),
              (T.doInsertData = function () {
                var e = T.insertStep,
                  t = T.insertTime;
                return 0 === T.dataHandler.waitInsertData.length
                  ? (T.dataHandler.setCardVisible(),
                    T.dataHandler.currItemId
                      ? T.doModalByIndex("point")
                      : T.doModalToFit(),
                    void T.update())
                  : new Promise(function (n) {
                      T.dataHandler.waitInsertData.length < 200 &&
                        ((e = T.hsInsertStep), (t = T.hsInsertTime));
                      var i = T.dataHandler.waitInsertData.splice(0, e);
                      i.length > 0 &&
                        ((T.dataHandler.data = T.dataHandler.data.concat(i)),
                        T.update(),
                        T.waitTimeout(t, n));
                    }).then(function () {
                      T.dataHandler.currItemId
                        ? T.doModalByIndex("point")
                        : T.doModalToFit(),
                        T.doInsertData();
                    });
              }),
              (T.getAllDataDraw = function () {
                var e = T.getCurrentData();
                return T.renderHandler.drawComment(), e;
              }),
              (T.beforeModifyComment = function (e) {
                var t = e.detail.bubbleId,
                  n = T.dataHandler,
                  i = n.hasTempComment,
                  a = n.tempBubbleId;
                i &&
                  t === a &&
                  T.commitTempComment({
                    callback: function (e) {
                      e ||
                        T.discardTempComment({
                          isResetElements: !0,
                          isUpdatePosition: !0,
                        });
                    },
                  }),
                  T.getAllData(),
                  T.update();
              }),
              (T.insertComment =
                ((m = d()(
                  regeneratorRuntime.mark(function e(t) {
                    var n, i, a, r, s, d, l;
                    return regeneratorRuntime.wrap(
                      function (e) {
                        for (;;)
                          switch ((e.prev = e.next)) {
                            case 0:
                              if (
                                (T.app.commentsDataManager.onInsertComment(),
                                !t.comments)
                              ) {
                                e.next = 47;
                                break;
                              }
                              if (
                                ((n =
                                  T.dataHandler.currItemId === t.comments.id &&
                                  T.dataHandler.isCurrItemExist()),
                                sessionStorage.setItem(
                                  "isExist_" + T.dataHandler.currItemId,
                                  !0
                                ),
                                T.getAllDataDraw(),
                                (i = t.woUserId),
                                (a = T.renderHandler.cooperInfo.coopInfos),
                                (r = a.find(function (e) {
                                  return e.tagid === i;
                                })),
                                !(
                                  a.length > 1 &&
                                  r &&
                                  T.app.info &&
                                  T.app.info.userid &&
                                  r.userid !== T.app.info.userid
                                ))
                              ) {
                                e.next = 15;
                                break;
                              }
                              return T.update(), (e.next = 12), T.waitTimeout();
                            case 12:
                              return (
                                T.doModalByIndex("", {}, t.comments.id),
                                sessionStorage.getItem(
                                  "isExist_" + T.dataHandler.currItemId
                                ) &&
                                  sessionStorage.removeItem(
                                    "isExist_" + T.dataHandler.currItemId
                                  ),
                                e.abrupt("return")
                              );
                            case 15:
                              if (!n) {
                                e.next = 25;
                                break;
                              }
                              return T.update(), (e.next = 19), T.waitTimeout();
                            case 19:
                              return (
                                T.doModalByIndex(),
                                (e.next = 22),
                                T.waitTimeout()
                              );
                            case 22:
                              sessionStorage.getItem(
                                "isExist_" + T.dataHandler.currItemId
                              ) &&
                                sessionStorage.removeItem(
                                  "isExist_" + T.dataHandler.currItemId
                                ),
                                (e.next = 44);
                              break;
                            case 25:
                              if (
                                ((s = t.comments.id),
                                T.dataHandler.hasTempComment &&
                                  T.dataHandler.tempTrueBubbleId === s &&
                                  (s = T.dataHandler.tempBubbleId),
                                (d = T.dataHandler.dataIdObj[s]),
                                !s || !d)
                              ) {
                                e.next = 40;
                                break;
                              }
                              if (
                                !T.dataHandler.hasTempComment ||
                                T.dataHandler.tempBubbleId !== s
                              ) {
                                e.next = 34;
                                break;
                              }
                              (l = T.dataHandler.dataIdObj[s]),
                                T.activeRender({
                                  data: l,
                                  id: s,
                                  range: { pos: t.pos, len: t.len },
                                  focus: !0,
                                  cb: null,
                                  type: null,
                                  forceUpdate: !1,
                                  useTrans: !0,
                                }),
                                (e.next = 38);
                              break;
                            case 34:
                              return T.update(), (e.next = 37), T.waitTimeout();
                            case 37:
                              T.doModalByIndex();
                            case 38:
                              e.next = 44;
                              break;
                            case 40:
                              return T.update(), (e.next = 43), T.waitTimeout();
                            case 43:
                              T.doModalByIndex();
                            case 44:
                              T.commentTip.visible ||
                                T.app.appApi.showComments({
                                  checked: !0,
                                  stored: !1,
                                }),
                                (e.next = 52);
                              break;
                            case 47:
                              return (
                                (T.disableScrollFetch = !0),
                                T.update(),
                                (e.next = 51),
                                T.waitTimeout()
                              );
                            case 51:
                              T.doModalToFitOther();
                            case 52:
                              C.default.dispatchEvent(
                                C.default.comments.AFTER_COMMENT_INSERTED
                              );
                            case 53:
                            case "end":
                              return e.stop();
                          }
                      },
                      e,
                      o
                    );
                  })
                )),
                function (e) {
                  return m.apply(this, arguments);
                })),
              (T.changeText = function (e) {
                if (T.app.commentShowStatus.commentPanel)
                  C.default.dispatchEvent(
                    C.default.comments.DRAW_CONTENT_BY_COMMENT,
                    {}
                  );
                else {
                  var t = T.judgeHasNewRevision(e),
                    n = t.rc,
                    i = t.hasNew;
                  T.getAllDataDraw(), T.debounceUpdateText(e, n, i);
                }
              }),
              (T.editCommentBody = function (e) {
                if (
                  T.dataHandler.hasTempComment &&
                  (T.getAllDataDraw(),
                  T.update(),
                  e.type === I.NOTIFY_TYPE.insertCommentText)
                ) {
                  var t = T.dataHandler,
                    n = t.tempBubbleId,
                    i = t.tempRcId,
                    a = t.dataIdObj[n],
                    o = [].concat(
                      r()(
                        a
                          ? a.data.map(function (e) {
                              return e.rc_id;
                            })
                          : [i]
                      )
                    );
                  T.app.data.selection.activeCommentPara([], o);
                }
              }),
              (T.debounceUpdateText =
                ((p = d()(
                  regeneratorRuntime.mark(function e(t, n, i) {
                    var a, r;
                    return regeneratorRuntime.wrap(
                      function (e) {
                        for (;;)
                          switch ((e.prev = e.next)) {
                            case 0:
                              return T.update(), (e.next = 3), T.waitTimeout();
                            case 3:
                              if (
                                t.type !== I.NOTIFY_TYPE.setProp &&
                                t.type !== I.NOTIFY_TYPE.delInsSame
                              ) {
                                e.next = 17;
                                break;
                              }
                              if (!n) {
                                e.next = 15;
                                break;
                              }
                              if (n.type !== I.CR_TYPE.comments) {
                                e.next = 9;
                                break;
                              }
                              T.dataHandler.currItemId === n.id &&
                                T.activeRender({
                                  range: n.range,
                                  id: n.id,
                                  focus: !1,
                                  data: n,
                                  cb: null,
                                  type: "point",
                                }),
                                (e.next = 15);
                              break;
                            case 9:
                              if (!(n.data.length > 0)) {
                                e.next = 15;
                                break;
                              }
                              return (
                                (a = void 0),
                                (r = void 0),
                                n.data.forEach(function (e, t) {
                                  var n = e,
                                    i = n.range || { pos: n.pos, len: n.len };
                                  if (0 == t) (r = i), (a = t);
                                  else {
                                    var o = n.range || {
                                      pos: n.pos,
                                      len: n.len,
                                    };
                                    o.pos === r.pos
                                      ? o.len <= r.len && ((r = o), (a = t))
                                      : ((r = o), (a = t));
                                  }
                                }),
                                (T.selectionCache = r),
                                T.activeRender({
                                  range: r,
                                  id: n.data[a].rc_id,
                                  focus: !1,
                                  data: n.data[a],
                                  cb: null,
                                  type: "point",
                                  forceUpdate: i,
                                }),
                                e.abrupt("return")
                              );
                            case 15:
                              e.next = 21;
                              break;
                            case 17:
                              if (!T.dataHandler.currItemId) {
                                e.next = 21;
                                break;
                              }
                              return (
                                T.dataHandler.ModifyModalToFit(),
                                T.update(),
                                e.abrupt("return")
                              );
                            case 21:
                              t.type !== I.NOTIFY_TYPE.insertComment &&
                                T.judgeFitOrOther();
                            case 22:
                            case "end":
                              return e.stop();
                          }
                      },
                      e,
                      o
                    );
                  })
                )),
                function (e, t, n) {
                  return p.apply(this, arguments);
                })),
              (T.deleteComment =
                ((f = d()(
                  regeneratorRuntime.mark(function e(t) {
                    return regeneratorRuntime.wrap(
                      function (e) {
                        for (;;)
                          switch ((e.prev = e.next)) {
                            case 0:
                              if (
                                (T.app.commentsDataManager.onDeleteComment(),
                                T.getAllDataDraw(),
                                T.update(),
                                !(
                                  t.comments &&
                                  t.comments.data &&
                                  t.comments.data.length > 0
                                ))
                              ) {
                                e.next = 11;
                                break;
                              }
                              return (
                                T.resetTempCommentWhenDeleted(!1),
                                T.update(),
                                (e.next = 8),
                                T.waitTimeout()
                              );
                            case 8:
                              T.doModalByIndex(), (e.next = 17);
                              break;
                            case 11:
                              return (
                                T.resetTempCommentWhenDeleted(!0),
                                T.dataHandler.tempBubbleId &&
                                  T.dataHandler.setModalVisibleById(
                                    T.dataHandler.tempBubbleId
                                  ),
                                T.update(),
                                (e.next = 16),
                                T.waitTimeout()
                              );
                            case 16:
                              T.doModalToFitOther();
                            case 17:
                            case "end":
                              return e.stop();
                          }
                      },
                      e,
                      o
                    );
                  })
                )),
                function (e) {
                  return f.apply(this, arguments);
                })),
              (T.setActive =
                ((v = d()(
                  regeneratorRuntime.mark(function e(t, n, i, a, r) {
                    var s,
                      d,
                      l,
                      u,
                      c =
                        !(arguments.length > 5 && void 0 !== arguments[5]) ||
                        arguments[5],
                      m =
                        arguments.length > 6 &&
                        void 0 !== arguments[6] &&
                        arguments[6];
                    return regeneratorRuntime.wrap(
                      function (e) {
                        for (;;)
                          switch ((e.prev = e.next)) {
                            case 0:
                              if (n) {
                                e.next = 3;
                                break;
                              }
                              return (
                                console.log("id incorrect"),
                                e.abrupt("return", !1)
                              );
                            case 3:
                              if (
                                (i && L.isIPad && Object(V.focusOnOtherInput)(),
                                T.dataHandler.currItemId === n && !m)
                              ) {
                                e.next = 15;
                                break;
                              }
                              return (
                                T.dataHandler.setModalVisibleById(n),
                                T.update(),
                                T.dataHandler.currItemId !== I.TEMP &&
                                  T.dataHandler.deleteCommentGroupById(
                                    I.TEMP,
                                    void 0,
                                    !1,
                                    !0
                                  ),
                                (e.next = 10),
                                T.waitTimeout()
                              );
                            case 10:
                              T.dataHandler.ModifyModalToFitPart(n, !1, !1, !0),
                                T.update(),
                                (s = T.dataHandler.data.find(function (e) {
                                  return e.id === n;
                                })) &&
                                  !T.checkAndAdjustBubblePosition(s)
                                    .isVisible &&
                                  ((d = T.calculateScrollTop(s)),
                                  (l = d.pageIndex),
                                  (u = d.srcollTop),
                                  C.default.dispatchEvent(
                                    C.default.comments.CR_PAGE_SCROLL,
                                    { pageIndex: l, scrollTop: u }
                                  )),
                                a && a.call(T);
                            case 15:
                              if (!i) {
                                e.next = 25;
                                break;
                              }
                              if (!c) {
                                e.next = 19;
                                break;
                              }
                              e.next = 22;
                              break;
                            case 19:
                              return (e.next = 21), T.waitTimeout(200);
                            case 21:
                              T.update();
                            case 22:
                              (T.disableScrollFetch = !0),
                                T.app.workspace.makesureCursorVisible(
                                  !0,
                                  !1,
                                  re.default.CENTER
                                ),
                                T.app.workspace.resizeIfNecessary({});
                            case 25:
                            case "end":
                              return e.stop();
                          }
                      },
                      e,
                      o
                    );
                  })
                )),
                function (e, t, n, i, a) {
                  return v.apply(this, arguments);
                })),
              (T.onActive = function (e, t, n) {
                if (t !== I.TEMP) {
                  var i = T.dataHandler.tempCommentId,
                    a = T.dataHandler.tempBubbleId;
                  if (t === a)
                    if (
                      n.data.find(function (t) {
                        return (
                          t.comment_id === i &&
                          Object(J.isRangeIntersect)(
                            { pos: t.pos, len: t.len },
                            e
                          )
                        );
                      })
                    )
                      return;
                  var o = n.type === I.CR_TYPE.comments;
                  if (
                    (T.dataHandler.hasTempComment &&
                      T.commitTempComment({
                        isUpdatePosition: !1,
                        callback: function (e) {
                          e || T.discardTempComment({ isResetElements: !0 });
                        },
                      }),
                    T.onActiveRenderAndSetPos(e, t, n),
                    (T.selectionCache = e),
                    !o)
                  ) {
                    void 0 !== e.idx &&
                      e.docType !== I.DOC_TYPE.main &&
                      T.app.data.selection.selContext.setHeaderfooterLayoutIndex(
                        e.idx
                      );
                    var r = e.pos,
                      s = e.len,
                      d = new oe.default(T.app.data.selection, {
                        begin: r,
                        end: r + s,
                      }),
                      l = d.begin && d.begin.position,
                      u = r + s;
                    "number" == typeof l && l !== r && (u = r),
                      T.app.data.selection.setPosition(r, u, {
                        updateOnly: L.isPad,
                      }),
                      Object(S.makePosVisible)(e.pos),
                      T.renderHandler.inactiveCommentPara();
                  }
                  var c =
                    1 === Object.keys(n).length
                      ? T.dataHandler.data.find(function (e) {
                          return e.id === t;
                        })
                      : n;
                  if (c) {
                    var m = T.app.appApi,
                      p = m.isKeyboardActive,
                      h = m.keyboardHeight,
                      f = window.APP.workspace.element.cacheDOMAttr,
                      v = f.clientHeight,
                      g = f.scrollTop,
                      w = g + v - (p ? h : 0),
                      b = T.dataHandler.getPosByRange(n.range),
                      y = b < g || b > w,
                      _ = T.checkAndAdjustBubblePosition(c),
                      E = _.isVisible,
                      M = _.diffY;
                    if (y || !E) {
                      Object(S.makePosVisible)(e.pos, M);
                      var P = T.calculateScrollTop(c),
                        R = P.pageIndex,
                        k = P.srcollTop;
                      T.app.isWebMode() &&
                        ((T.onWebModeScroll.isScroll = !0),
                        (T.onWebModeScroll.dataId = c.id)),
                        C.default.dispatchEvent(
                          C.default.comments.CR_PAGE_SCROLL,
                          { pageIndex: R, scrollTop: k }
                        );
                    }
                  }
                  window.collection(
                    "commandbar",
                    "click",
                    o ? "comment_card" : "review_card"
                  );
                }
              }),
              (T.onDidMount = function () {
                T.didMount = !0;
                var e = T.handleBookmark();
                e ? T.setActive(null, e) : T.setModalPos(),
                  (T.firstLocatePos = T.getFirstLocatePos()),
                  T.showRevisionHandle(!0);
              }),
              (T.onClose = function (e) {
                if (T.isCommentBubbleStatus && T.dataHandler.currItemId) {
                  if (T.dataHandler.hasTempComment)
                    if (e && !T.isReEditComment) {
                      var t = T.app.editor.cmdExecutor.getCurrentLocalCommand();
                      if (t && "insertComment" !== t.name) return;
                      var n = T.dataHandler.dataIdObj[I.TEMP];
                      n && n.data && 1 === n.data.length
                        ? T.dataHandler.ModifyModalToFitPart(
                            T.dataHandler.tempBubbleId,
                            !0,
                            !1
                          )
                        : T.setModalLandscape(!1),
                        T.discardTempComment({
                          isForce: !0,
                          isResetContext: !0,
                          isResetElements: !0,
                          isUpdatePosition: !0,
                        });
                    } else
                      T.commitTempComment({
                        callback: function (e) {
                          e
                            ? T.setModalLandscape(!1)
                            : T.discardTempComment({
                                isResetElements: !0,
                                isUpdatePosition: !0,
                              });
                        },
                      });
                  else {
                    var i = T.app.data.selection.selContext;
                    i.isInComment() &&
                      T.resetCommentSelection({ comment_id: i.commentId }),
                      T.setModalLandscape(!1);
                  }
                  T.app.uilManager.uiHandler.handleFocusEvent(!0),
                    T.app.workspace.resizeIfNecessary(),
                    T.renderHandler.inactiveCommentPara(),
                    T.renderHandler.outCommentPara(),
                    (T.selectionCache = {}),
                    C.default.dispatchEvent(
                      C.default.revision.ON_REVISION_FILTER_ACTIVE_CHANGE
                    );
                }
              }),
              (T.onEditItem = function (e) {
                var t = T.app.data.doc.comments.getCommentByCommentId(
                  e.comment_id
                );
                if (t) {
                  T.dataHandler.hasTempComment &&
                    T.discardTempComment({
                      isResetContext: !0,
                      bSendSelectionBack: !1,
                    });
                  var n = t.body.pos + t.body.len - 1;
                  T.app.data.selection.setPosition(n, n, { isSend: !0 }),
                    T.dataHandler.setEditingCommentId(t.comment_id),
                    T.restoreTempComment(),
                    T.app.data.selection.setPosition(t.pos, t.pos + t.len);
                }
              }),
              (T.onDeleteItem =
                ((g = d()(
                  regeneratorRuntime.mark(function e(t) {
                    return regeneratorRuntime.wrap(
                      function (e) {
                        for (;;)
                          switch ((e.prev = e.next)) {
                            case 0:
                              if (t) {
                                e.next = 3;
                                break;
                              }
                              return (
                                console.warn("wrong comment"),
                                e.abrupt("return")
                              );
                            case 3:
                              T.dataHandler.hasTempComment
                                ? T.commitOrDiscardComment()
                                : T.app.data.selection.selContext.isInComment() &&
                                  T.resetCommentSelection(t),
                                t.comment_id
                                  ? T.app.services.userCommentsManager.docUserCommentsHandle.removeCommentById(
                                      t.comment_id
                                    )
                                  : T.app.services.userCommentsManager.docUserCommentsHandle.removeCommentByLocalId(
                                      t.rc_id
                                    );
                            case 5:
                            case "end":
                              return e.stop();
                          }
                      },
                      e,
                      o
                    );
                  })
                )),
                function (e) {
                  return g.apply(this, arguments);
                })),
              (T.onHover = function (e, t, n) {
                n === I.CR_TYPE.comments &&
                  T.renderHandler.hoverCommentPara({
                    detail: { range: e, comments: t, isPara: !0 },
                  }),
                  n === I.CR_TYPE.revision &&
                    T.revisionLinesManager.toggleHighlightLine(t, !0);
              }),
              (T.onLeave = function (e, t, n) {
                n === I.CR_TYPE.comments && T.renderHandler.outCommentPara(),
                  n === I.CR_TYPE.revision &&
                    T.revisionLinesManager.toggleHighlightLine(t, !1);
              }),
              (T.handleGetOnline = function (e) {
                var t = e.detail,
                  n = t.modal_id,
                  i = t.comment;
                T.waitGetComments.push(i),
                  T.waitRefreshModal.push(n),
                  T.debounceGetOnline();
              }),
              (T.doGetOnline = d()(
                regeneratorRuntime.mark(function e() {
                  var t, n;
                  return regeneratorRuntime.wrap(
                    function (e) {
                      for (;;)
                        switch ((e.prev = e.next)) {
                          case 0:
                            return (
                              (t = T.waitGetComments),
                              (T.waitGetComments = []),
                              (e.next = 4),
                              T.app.servicesLoader.commentsDataManager.getComments(
                                t
                              )
                            );
                          case 4:
                            (n = T.waitRefreshModal),
                              (T.waitRefreshModal = []),
                              C.default.dispatchEvent(
                                C.default.comments.GET_ONLINE_COMMENTS_END,
                                { ids: Array.from(new Set(n)) }
                              ),
                              T.renderHandler.drawComment();
                          case 8:
                          case "end":
                            return e.stop();
                        }
                    },
                    e,
                    o
                  );
                })
              )),
              (T.setModalPos =
                ((w = d()(
                  regeneratorRuntime.mark(function e(t) {
                    return regeneratorRuntime.wrap(
                      function (e) {
                        for (;;)
                          switch ((e.prev = e.next)) {
                            case 0:
                              return (
                                T.dataHandler.setModalVisibleById(t && t.id),
                                T.update(t),
                                (e.next = 4),
                                T.waitTimeout()
                              );
                            case 4:
                              T.doModalToFit(t);
                            case 5:
                            case "end":
                              return e.stop();
                          }
                      },
                      e,
                      o
                    );
                  })
                )),
                function (e) {
                  return w.apply(this, arguments);
                })),
              (T.setModalLandscape =
                ((b = d()(
                  regeneratorRuntime.mark(function e(t) {
                    return regeneratorRuntime.wrap(
                      function (e) {
                        for (;;)
                          switch ((e.prev = e.next)) {
                            case 0:
                              return (
                                T.dataHandler.setModalVisibleById(),
                                T.update(),
                                (e.next = 4),
                                T.waitTimeout()
                              );
                            case 4:
                              T.doModalToFit();
                            case 5:
                            case "end":
                              return e.stop();
                          }
                      },
                      e,
                      o
                    );
                  })
                )),
                function (e) {
                  return b.apply(this, arguments);
                })),
              (T.doModelToScroll = function () {
                T.doModalToFit();
              }),
              (T.doModalToFit = function (e) {
                T.dataHandler.ModifyModalToFit(), T.update(e);
              }),
              (T.doModalByIndex = function (e, t, n, i) {
                T.dataHandler.ModifyModalByIndex(e, n, i), T.update(t);
              }),
              (T.doModalToFitOther = function () {
                T.dataHandler.ModifyOtherModalToFit(), T.update();
              }),
              (T.doModalToFitOtherBySpecific = function (e) {
                T.dataHandler.ModifyModalToFitPart(e, !1), T.update();
              }),
              (T.refresh =
                ((y = d()(
                  regeneratorRuntime.mark(function e(t) {
                    return regeneratorRuntime.wrap(
                      function (e) {
                        for (;;)
                          switch ((e.prev = e.next)) {
                            case 0:
                              if (T.isCommentBubbleStatus) {
                                e.next = 2;
                                break;
                              }
                              return e.abrupt("return");
                            case 2:
                              if (
                                0 !== T.dataHandler.getData().length &&
                                T.didMount
                              ) {
                                e.next = 4;
                                break;
                              }
                              return e.abrupt("return", !1);
                            case 4:
                              "resize" === t
                                ? ((T.height =
                                    document.getElementById(
                                      "workspace"
                                    ).offsetHeight),
                                  T.commentTip.resize(),
                                  T.getAllDataDraw(),
                                  T.dataHandler.currItemId &&
                                  T.dataHandler
                                    .getVisibleData()
                                    .find(function (e) {
                                      return e.id === T.dataHandler.currItemId;
                                    })
                                    ? T.doModalByIndex("point")
                                    : T.doModalByIndex(null))
                                : "scale" === t
                                ? requestAnimationFrame(function () {
                                    T.openModalByRange(
                                      T.app.data.selection.getNormalRange()
                                    );
                                  })
                                : (T.dataHandler.setModalVisibleById(null),
                                  T.setModalPos());
                            case 5:
                            case "end":
                              return e.stop();
                          }
                      },
                      e,
                      o
                    );
                  })
                )),
                function (e) {
                  return y.apply(this, arguments);
                })),
              (T.updateLayout = function () {
                if (!T.app.commentShowStatus.commentPanel) {
                  if (0 === T.dataHandler.getData().length || !T.didMount)
                    return !1;
                  T.updateLayoutFrame &&
                    cancelAnimationFrame(T.updateLayoutFrame),
                    (T.updateLayoutFrame = requestAnimationFrame(function () {
                      T.doModalToFit(), (T.updateLayoutFrame = null);
                    }));
                }
              }),
              (T.locateCommentContent = function (e) {
                var t = e.detail,
                  n = t.range,
                  i = t.bubbleId;
                T.setActive(n, i);
              }),
              (T.onActiveEvent = function (e) {
                var t = e.detail,
                  n = t.range,
                  i = t.id,
                  a = t.data;
                T.onActive(n, i, a);
              }),
              (T.onAddItemEvent =
                ((_ = d()(
                  regeneratorRuntime.mark(function e(t) {
                    return regeneratorRuntime.wrap(
                      function (e) {
                        for (;;)
                          switch ((e.prev = e.next)) {
                            case 0:
                              return (
                                (e.next = 2),
                                T.insertTempComment(t.detail.params)
                              );
                            case 2:
                            case "end":
                              return e.stop();
                          }
                      },
                      e,
                      o
                    );
                  })
                )),
                function (e) {
                  return _.apply(this, arguments);
                })),
              (T.onEditItemEvent = function (e) {
                T.onEditItem(e.detail.params);
              }),
              (T.onDeleteItemEvent =
                ((E = d()(
                  regeneratorRuntime.mark(function e(t) {
                    return regeneratorRuntime.wrap(
                      function (e) {
                        for (;;)
                          switch ((e.prev = e.next)) {
                            case 0:
                              return (
                                (e.next = 2), T.onDeleteItem(t.detail.params)
                              );
                            case 2:
                            case "end":
                              return e.stop();
                          }
                      },
                      e,
                      o
                    );
                  })
                )),
                function (e) {
                  return E.apply(this, arguments);
                })),
              (T.onDeleteItemsEvent = function (e) {
                var t = e && e.detail && e.detail.comments;
                t &&
                  (T.dataHandler.hasTempComment && T.discardTempComment(),
                  T.app.services.userCommentsManager.docUserCommentsHandle.removeComments(
                    t
                  ));
              }),
              (T.onReplyItemEvent = function (e) {
                var t = e.detail.params.replyId;
                if (void 0 !== t) {
                  if (
                    T.dataHandler.tempReplyId === t &&
                    !T.dataHandler.reEditCommentId
                  )
                    return (
                      T.workspace.updateCommentIndicator(!0, !0),
                      void setTimeout(function () {
                        return (
                          T.workspace.locateTimeoutID &&
                          clearTimeout(T.workspace.locateTimeoutID)
                        );
                      })
                    );
                  T.dataHandler.hasTempComment && T.discardTempComment(),
                    L.isIPad && Object(V.focusOnOtherInput)();
                }
                T.insertTempComment({ replyId: t });
              }),
              (T.onCancelReplyItemEvent = function (e) {
                T.discardTempComment({ isForce: !0, isUpdatePosition: !0 });
              }),
              (T.onHoverEvent = function (e) {
                var t = e.detail,
                  n = t.range,
                  i = t.data,
                  a = t.type;
                T.onHover(n, i, a);
              }),
              (T.onLeaveEvent = function (e) {
                var t = e.detail,
                  n = t.pos,
                  i = t.data,
                  a = t.type;
                T.onLeave(n, i, a);
              }),
              (T.onCloseEvent = function (e) {
                T.onClose(e.detail.isDiscardComment);
              }),
              (T.onDidMountEvent = function () {
                T.onDidMount();
              }),
              (T.update = function (e) {
                if (!T.workspace.unMount) {
                  var t = (e && e.left) || T.dataHandler.left,
                    n = T.dataHandler.getViewData(!0),
                    i = n.data,
                    a = n.tops,
                    o = n.ranges,
                    r = n.length;
                  T.dataHandler.setLeft(t),
                    T.renderHandler.render({
                      tops: a,
                      ranges: o,
                      data: i,
                      length: r,
                      currId: T.dataHandler.currItemId,
                      replyId: T.dataHandler.tempReplyId,
                    }),
                    T.revisionLinesManager.render(
                      n,
                      !(e && "scroll" === e.trigger)
                    );
                }
              }),
              (T.handleRevisionFilterParamsChange = function (e) {
                (T.revisionFilterParams = e.detail),
                  T.getScrollData(),
                  window.APP.workspace.refreshForcedly();
              }),
              (T.checkAndAdjustBubblePosition = function (e) {
                var t = T.app.isWebMode() ? 0 : e.pageIndex,
                  n = T.dataHandler.scrollTop[t] || 0,
                  i = e.position.top - n,
                  a = T.getPageRect(t),
                  o = e.height || T.dataHandler.getHeight(e.id),
                  r = !1;
                if (!a) return r;
                if (!(r = i >= a.top && i + o < a.height + a.top)) return r;
                var s = T.app.appApi,
                  d = s.isKeyboardActive,
                  l = s.keyboardHeight,
                  u = T.app.workspace.element.cacheDOMAttr,
                  c = u.clientHeight,
                  m = u.scrollTop,
                  p = m + c - (d ? l : 0),
                  h = 0;
                return (
                  i < m ? (h += m - i) : i + o >= p && (h -= o),
                  { isVisible: (r = i >= m && i + o < p), diffY: i - m + h }
                );
              }),
              (T.calculateScrollTop = function (e) {
                var t = window.APP.restrictEditHandler.isInFormProtectMode
                    ? T.dataHandler.getPosByRange(e.range)
                    : T.dataHandler.getPosBySelection(),
                  n = T.app.isWebMode(),
                  i = n ? 0 : e.pageIndex,
                  a = e.height || T.dataHandler.getHeight(e.id),
                  o = void 0,
                  r = e.position.top - t;
                (n || (o = T.getPageRect(i)), o && t > o.top + o.height) &&
                  (r = e.position.top - o.top + a - o.height);
                return { pageIndex: i, srcollTop: r };
              }),
              (T.getPageRect = function (e) {
                var t = T.app.workspace.canvasHandler;
                if (T.app.isWebMode()) return t.rect;
                var n = t.getPageInfo(e);
                return n ? n.getBoundRect() : null;
              }),
              (T.scaleContainer = a),
              (T.debounceUpdateText = window.utils.Lodash.debounce(
                T.debounceUpdateText,
                150
              )),
              (T.refresh = window.utils.Lodash.debounce(T.refresh, 100)),
              (T.debounceGetOnline = window.utils.Lodash.debounce(
                T.doGetOnline,
                100
              )),
              (T.debounceModifyModalToFit = window.utils.Lodash.debounce(
                T.doModalToFit,
                100
              )),
              (T.debounceModifyModalByIndex = window.utils.Lodash.debounce(
                T.doModalByIndex,
                100
              )),
              (T.debounceViewportChange = window.utils.Lodash.debounce(
                T.viewportChange,
                100
              )),
              (T.debounceShowCommentsHandle = window.utils.Lodash.debounce(
                T.showCommentsHandle,
                100
              )),
              (T.onScroll = X()(T.onScrollSlide, 100, { leading: !1 })),
              (T.onScrollVisible = window.utils.Lodash.throttle(
                T.onScrollVisible,
                100
              )),
              (T.updateLayout = window.utils.Lodash.debounce(
                T.updateLayout,
                300
              )),
              (T.updateLayoutFrame = null),
              (T.commentTip = new Y(e, n, a)),
              (T.dataHandler = new A(e, n, T)),
              (T.commentComponentManager = new G.a()),
              (T.selectionCache = {}),
              (T.didMount = !1),
              (T.waitGetComments = []),
              (T.waitRefreshModal = []),
              (T.usedPageMax = 0),
              (T.allUsedPageMax = 0),
              (T.bookmarkInfo = T.app.initializedBookmarkInfo),
              (T.templateShowTime = 0),
              (T.currentActiveCommentRange = null),
              T.init(),
              (T.height = T.app.workspace.element.cacheDOMAttr.offsetHeight),
              (T.scrollTop = 0),
              (T.firstLocatePos = 0),
              (T.usedPage = []),
              (T.prevPages = []),
              (T.zoom = T.app.workspace.config.zoom),
              (T.revisionVisibleStatus = !1),
              (T.insertStep = 10),
              (T.insertTime = 50),
              (T.hsInsertStep = 20),
              (T.hsInsertTime = 30),
              (T.revisionLinesManager = new ie(n, i, T, T.dataHandler)),
              (T.revisionFilterParams = {}),
              (T.onWebModeScroll = { isScroll: !1, dataId: null }),
              T
            );
          }
          var n, i, o;
          return (
            w()(t, e),
            m()(t, [
              {
                key: "bindFixedEvents",
                value: function () {
                  this.isBindFixedEvents ||
                    ((this.isBindFixedEvents = !0),
                    window.addEventListener(
                      C.default.comments.ON_COMMENT_SHOW_STATUS_UPDATE,
                      this.onCommentShowStatusUpdate
                    ),
                    window.addEventListener(
                      C.default.comments.SHOW_COMMENTS,
                      this.debounceShowCommentsHandle
                    ),
                    window.addEventListener(
                      C.default.comments.ON_DID_MOUNT,
                      this.onDidMountEvent
                    ),
                    window.addEventListener(
                      C.default.revision.ENABLE_REVISION,
                      this.trackRevisionHandle
                    ),
                    window.addEventListener(
                      C.default.revision.REVISION_SETTINGS_CHANGE,
                      this.showRevisionHandle
                    ),
                    window.addEventListener(
                      C.default.names.DOC_COOPERATION_MODE_TOGGLED,
                      this.showRevisionHandle
                    ),
                    window.addEventListener(
                      C.default.revision.REVISION_ACCEPTREFUSE,
                      this.revisionAcceptRefuse
                    ),
                    window.addEventListener(
                      C.default.revision.SHOW_REVISION_BUBBLE,
                      this.showRevisionBubble
                    ),
                    window.addEventListener(
                      C.default.comments.INSERT_EMOJI_COMMENT_BY_BTN,
                      this.insertCommentByEmoji
                    ),
                    window.addEventListener(
                      C.default.comments.ON_DELETE_ITEMS,
                      this.onDeleteItemsEvent
                    ),
                    window.addEventListener(
                      C.default.comments.GET_ONLINE_AUDIT_COMMENTS,
                      this.updateCommentStatus
                    ),
                    window.addEventListener(
                      C.default.revision.ON_REVISION_FILTER_PARAMS_CHANGE,
                      this.handleRevisionFilterParamsChange
                    ));
                },
              },
              {
                key: "bindDynamicEvents",
                value: function () {
                  this.isBindDynamicEvents ||
                    ((this.isBindDynamicEvents = !0),
                    this.app.data.doc.attachObserver(this),
                    this.app.data.doc.reviewMgr.attachObserver(this),
                    window.addEventListener(
                      C.default.comments.ACTIVE_COMMENT_BY_RANGE,
                      this.activeCommentByRange
                    ),
                    window.addEventListener(
                      C.default.comments.INACTIVE_COMMENT,
                      this.inactiveComment
                    ),
                    window.addEventListener(
                      C.default.comments.ON_ADD_ITEM_BY_BTN,
                      this.openCommentsModal
                    ),
                    window.addEventListener(
                      C.default.comments.GET_ONLINE_COMMENTS,
                      this.handleGetOnline
                    ),
                    window.addEventListener(
                      C.default.comments.ON_ACTIVE,
                      this.onActiveEvent
                    ),
                    window.addEventListener(
                      C.default.comments.ON_ADD_ITEM_BY_MODAL,
                      this.onAddItemEvent
                    ),
                    window.addEventListener(
                      C.default.comments.ON_EDIT_ITEM,
                      this.onEditItemEvent
                    ),
                    window.addEventListener(
                      C.default.comments.ON_DELETE_ITEM,
                      this.onDeleteItemEvent
                    ),
                    window.addEventListener(
                      C.default.comments.ON_REPLY_ITEM,
                      this.onReplyItemEvent
                    ),
                    window.addEventListener(
                      C.default.comments.ON_CANCEL_REPLY_ITEM,
                      this.onCancelReplyItemEvent
                    ),
                    window.addEventListener(
                      C.default.comments.ON_HOVER,
                      this.onHoverEvent
                    ),
                    window.addEventListener(
                      C.default.comments.ON_LEAVE,
                      this.onLeaveEvent
                    ),
                    window.addEventListener(
                      C.default.comments.ON_CLOSE,
                      this.onCloseEvent
                    ),
                    window.addEventListener(
                      C.default.view.BEFORE_VIEW_MODE_CHANGED,
                      this.beforeViewModeChanged
                    ),
                    window.addEventListener(
                      C.default.comments.ON_EXIT_COMMENT_BODY,
                      this.onExitComment
                    ),
                    window.addEventListener(
                      C.default.comments.COMMIT_AND_INSERT_NEW_COMMENT,
                      this.commitAndInsertNewTempComment
                    ),
                    window.addEventListener(
                      C.default.restrictEdit.ON_RESTRICT_STATE_CHANGE,
                      this.handleRestrictEditModeChange
                    ),
                    window.addEventListener(
                      C.default.names.DOC_UNDO_REDO,
                      this.handleUndoRedo
                    ),
                    window.addEventListener(
                      C.default.comments.MENTION_IN_COMMENT,
                      this.mentionInComment
                    ),
                    window.addEventListener(
                      C.default.comments.BEFORE_MODIFY_COMMENT,
                      this.beforeModifyComment
                    ),
                    window.addEventListener(
                      y.default.names.ON_BEFORE_UNLOAD,
                      this.onBeforeUnload
                    ),
                    window.addEventListener(
                      C.default.comments.COMMENT_UPDATE_LAYOUT,
                      this.updateLayout
                    ),
                    window.addEventListener(
                      C.default.comments.SCROLL_FIND_COMMENT,
                      this.locateCommentContent
                    ));
                },
              },
              {
                key: "bindEvents",
                value: function () {
                  this.bindFixedEvents(),
                    this.app.commentShowStatus.commentBubble &&
                      this.bindDynamicEvents();
                },
              },
              {
                key: "unbindFixedEvents",
                value: function () {
                  this.isBindFixedEvents &&
                    ((this.isBindFixedEvents = !1),
                    window.removeEventListener(
                      C.default.comments.ON_COMMENT_SHOW_STATUS_UPDATE,
                      this.onCommentShowStatusUpdate
                    ),
                    window.removeEventListener(
                      C.default.comments.SHOW_COMMENTS,
                      this.debounceShowCommentsHandle
                    ),
                    window.removeEventListener(
                      C.default.comments.ON_DID_MOUNT,
                      this.onDidMountEvent
                    ),
                    window.removeEventListener(
                      C.default.revision.ENABLE_REVISION,
                      this.trackRevisionHandle
                    ),
                    window.removeEventListener(
                      C.default.revision.REVISION_SETTINGS_CHANGE,
                      this.showRevisionHandle
                    ),
                    window.removeEventListener(
                      C.default.names.DOC_COOPERATION_MODE_TOGGLED,
                      this.showRevisionHandle
                    ),
                    window.removeEventListener(
                      C.default.revision.REVISION_ACCEPTREFUSE,
                      this.revisionAcceptRefuse
                    ),
                    window.removeEventListener(
                      C.default.revision.SHOW_REVISION_BUBBLE,
                      this.showRevisionBubble
                    ),
                    window.removeEventListener(
                      C.default.comments.INSERT_EMOJI_COMMENT_BY_BTN,
                      this.insertCommentByEmoji
                    ),
                    window.removeEventListener(
                      C.default.comments.ON_DELETE_ITEMS,
                      this.onDeleteItemsEvent
                    ),
                    window.removeEventListener(
                      C.default.comments.GET_ONLINE_AUDIT_COMMENTS,
                      this.updateCommentStatus
                    ),
                    window.removeEventListener(
                      C.default.revision.ON_REVISION_FILTER_PARAMS_CHANGE,
                      this.handleRevisionFilterParamsChange
                    ));
                },
              },
              {
                key: "unbindDynamicEvents",
                value: function () {
                  this.isBindDynamicEvents &&
                    ((this.isBindDynamicEvents = !1),
                    this.app.data.doc.detachObserver(this),
                    this.app.data.doc.reviewMgr.detachObserver(this),
                    window.removeEventListener(
                      C.default.comments.ACTIVE_COMMENT_BY_RANGE,
                      this.activeCommentByRange
                    ),
                    window.removeEventListener(
                      C.default.comments.INACTIVE_COMMENT,
                      this.inactiveComment
                    ),
                    window.removeEventListener(
                      C.default.comments.ON_ADD_ITEM_BY_BTN,
                      this.openCommentsModal
                    ),
                    window.removeEventListener(
                      C.default.comments.GET_ONLINE_COMMENTS,
                      this.handleGetOnline
                    ),
                    window.removeEventListener(
                      C.default.comments.ON_ACTIVE,
                      this.onActiveEvent
                    ),
                    window.removeEventListener(
                      C.default.comments.ON_ADD_ITEM_BY_MODAL,
                      this.onAddItemEvent
                    ),
                    window.removeEventListener(
                      C.default.comments.ON_EDIT_ITEM,
                      this.onEditItemEvent
                    ),
                    window.removeEventListener(
                      C.default.comments.ON_DELETE_ITEM,
                      this.onDeleteItemEvent
                    ),
                    window.removeEventListener(
                      C.default.comments.ON_REPLY_ITEM,
                      this.onReplyItemEvent
                    ),
                    window.removeEventListener(
                      C.default.comments.ON_CANCEL_REPLY_ITEM,
                      this.onCancelReplyItemEvent
                    ),
                    window.removeEventListener(
                      C.default.comments.ON_HOVER,
                      this.onHoverEvent
                    ),
                    window.removeEventListener(
                      C.default.comments.ON_LEAVE,
                      this.onLeaveEvent
                    ),
                    window.removeEventListener(
                      C.default.comments.ON_CLOSE,
                      this.onCloseEvent
                    ),
                    window.removeEventListener(
                      C.default.view.BEFORE_VIEW_MODE_CHANGED,
                      this.beforeViewModeChanged
                    ),
                    window.removeEventListener(
                      C.default.comments.ON_EXIT_COMMENT_BODY,
                      this.onExitComment
                    ),
                    window.removeEventListener(
                      C.default.comments.COMMIT_AND_INSERT_NEW_COMMENT,
                      this.commitAndInsertNewTempComment
                    ),
                    window.removeEventListener(
                      C.default.restrictEdit.ON_RESTRICT_STATE_CHANGE,
                      this.handleRestrictEditModeChange
                    ),
                    window.removeEventListener(
                      C.default.names.DOC_UNDO_REDO,
                      this.handleUndoRedo
                    ),
                    window.removeEventListener(
                      C.default.comments.MENTION_IN_COMMENT,
                      this.mentionInComment
                    ),
                    window.removeEventListener(
                      C.default.comments.BEFORE_MODIFY_COMMENT,
                      this.beforeModifyComment
                    ),
                    window.removeEventListener(
                      y.default.names.ON_BEFORE_UNLOAD,
                      this.onBeforeUnload
                    ),
                    window.removeEventListener(
                      C.default.comments.COMMENT_UPDATE_LAYOUT,
                      this.updateLayout
                    ),
                    window.removeEventListener(
                      C.default.comments.SCROLL_FIND_COMMENT,
                      this.locateCommentContent
                    ));
                },
              },
              {
                key: "unbindEvents",
                value: function () {
                  this.unbindFixedEvents(),
                    this.app.commentShowStatus.commentBubble &&
                      this.unbindDynamicEvents();
                },
              },
              {
                key: "clearAll",
                value: function () {
                  v()(
                    t.prototype.__proto__ || Object.getPrototypeOf(t.prototype),
                    "clearAll",
                    this
                  ).call(this),
                    (this.disableScrollFetch = !0),
                    this.commentTip.clearAll(),
                    this.updateLayoutFrame &&
                      cancelAnimationFrame(this.updateLayoutFrame),
                    this.revisionLinesManager.clearAll();
                },
              },
              {
                key: "adjustCommentPosOnInsertText",
                value: function (e, t, n) {
                  return t <= e ? e + n.length : e;
                },
              },
              {
                key: "onInsertText",
                value: function (e, t, n, i) {
                  if (e === this.app.data.doc) {
                    var a = this.app.data.selection.selContext;
                    a.isInComment() &&
                      !isNaN(a.commentPos) &&
                      (a.commentPos = this.adjustCommentPosOnInsertText(
                        a.commentPos,
                        t,
                        n
                      ));
                  }
                },
              },
              {
                key: "adjustCommentPosOnDeleteText",
                value: function (e, t, n) {
                  var i = t + n.length;
                  return i <= e ? e - n.length : t < e && i > e ? t : e;
                },
              },
              {
                key: "onDeleteText",
                value: function (e, t, n, i) {
                  if (e === this.app.data.doc) {
                    var a = this.app.data.selection.selContext;
                    a.isInComment() &&
                      !isNaN(a.commentPos) &&
                      (a.commentPos = this.adjustCommentPosOnDeleteText(
                        a.commentPos,
                        t,
                        n
                      ));
                  }
                },
              },
              {
                key: "onInput",
                value:
                  ((o = d()(
                    regeneratorRuntime.mark(function e() {
                      var t, n;
                      return regeneratorRuntime.wrap(
                        function (e) {
                          for (;;)
                            switch ((e.prev = e.next)) {
                              case 0:
                                if (
                                  !this.dataHandler.hasTempComment ||
                                  !this.dataHandler.isNotifyTempComment
                                ) {
                                  e.next = 13;
                                  break;
                                }
                                if (!this.tempCommentCommitPromise) {
                                  e.next = 5;
                                  break;
                                }
                                return (
                                  (e.next = 4), this.tempCommentCommitPromise
                                );
                              case 4:
                                return e.abrupt("return", !1);
                              case 5:
                                return (
                                  (t = this.dataHandler.tempRcId),
                                  (n =
                                    this.app.data.doc.comments.getCommentByRcId(
                                      t
                                    ) || {}),
                                  (this.tempCommentCommitPromise =
                                    this.app.servicesLoader.commentsDataManager.commitComment(
                                      n
                                    )),
                                  (e.next = 10),
                                  this.tempCommentCommitPromise
                                );
                              case 10:
                                return (
                                  (this.tempCommentCommitPromise = null),
                                  (this.dataHandler.isNotifyTempComment = !1),
                                  e.abrupt("return", !1)
                                );
                              case 13:
                                return e.abrupt("return", !0);
                              case 14:
                              case "end":
                                return e.stop();
                            }
                        },
                        e,
                        this
                      );
                    })
                  )),
                  function () {
                    return o.apply(this, arguments);
                  }),
              },
              {
                key: "commitTempComment",
                value: function () {
                  var e = this,
                    t =
                      arguments.length > 0 && void 0 !== arguments[0]
                        ? arguments[0]
                        : {},
                    n = t.callback,
                    i = t.resetNow,
                    o = this.workspace.commentInput;
                  if (!o || !o.element || !o.value)
                    return (
                      this.app.uilManager.resetCommentElements(), n && n(!1), !1
                    );
                  var r = o.value,
                    s = r.content,
                    d = r.count,
                    l = r.contents,
                    u = r.nodes;
                  if (!d) return n && n(!1), !1;
                  if (this.isMakingComment) return n && n(!1), !1;
                  window.collection("commandbar", "click", "comment_send"),
                    (this.isMakingComment = !0);
                  var c = this.dataHandler,
                    m = c.tempRange,
                    p = c.tempReplyId,
                    h = c.reEditCommentId;
                  i &&
                    (this.dataHandler.resetTempCommentBubble(),
                    this.app.uilManager.resetCommentElements());
                  var f = { text: s, cid: h, p_comment_id: p };
                  window.__WPSENV__
                    .reduxDispatch(Object(W.commentReviewAsync)(f))
                    .then(function (t) {
                      if (t.error);
                      else if (t && t.response && t.response.body) {
                        var o = t.response.body,
                          r = o.comment_id,
                          d = o.user_info,
                          c = o.p_comment_id,
                          f = o.content,
                          v = void 0 === f ? {} : f,
                          g = o.time,
                          w = c || p,
                          b = {
                            range: m,
                            text: s,
                            replyId: w,
                            isReply: !!w,
                            contents: l,
                            content: a()({}, v, { text: v.text || s }),
                            comment_id: r,
                            time: g,
                            user_info: d,
                            p_comment_id: w,
                          };
                        i ||
                          (e.dataHandler.resetTempCommentBubble(),
                          e.app.uilManager.resetCommentElements());
                        var y = h
                          ? e.app.commentsDataManager.modifyComment(
                              a()({}, b, { commentId: r })
                            )
                          : e.app.commentsDataManager.commitTempComment(
                              a()({}, b, { commentId: r })
                            );
                        if (!y) return n && n(!1), !1;
                        var I = m,
                          _ = e.app.data.doc.commentBubbles.getBubbleByRange(
                            m.pos,
                            m.len
                          );
                        _ && (I = _.range),
                          e.app.servicesLoader.commentsDataManager.setCommentCacheObjProperty(
                            r,
                            b
                          ),
                          e.app.commentsDataManager.notifyComment({
                            id: h || y.comment_id,
                            isVoice: !1,
                            text: s,
                            duration: 0,
                          }),
                          C.default.dispatchEvent(
                            C.default.comments.COMMENT_INSERTOREDIT_SUCCESS,
                            {
                              type: h ? "edit" : "insert",
                              commentId: h || y.comment_id,
                              nodes: u,
                            }
                          ),
                          n && n(!h && I);
                      }
                    })
                    .finally(function () {
                      e.isMakingComment = !1;
                    });
                },
              },
              {
                key: "resetTempComment",
                value: function (e) {
                  this.dataHandler.resetTempCommentBubble(),
                    this.app.uilManager.exitCommentBody();
                },
              },
              {
                key: "discardTempComment",
                value: function () {
                  var e =
                      arguments.length > 0 && void 0 !== arguments[0]
                        ? arguments[0]
                        : {},
                    t = e.isForce,
                    n = void 0 !== t && t,
                    i = e.isResetContext,
                    a = void 0 !== i && i,
                    o = e.isResetElements,
                    r = void 0 !== o && o,
                    s = e.isUpdatePosition,
                    d = void 0 !== s && s,
                    l = e.bSendSelectionBack,
                    u = void 0 === l ? L.isPad : l;
                  if (this.dataHandler.hasTempComment)
                    return (
                      this.dataHandler.resetTempCommentBubble(),
                      this.app.uilManager.exitCommentBody(),
                      this.app.data.selection.setPosition(
                        this.app.data.selection.begin.pos
                      ),
                      void this.update()
                    );
                  var c = this.dataHandler.tempRcId,
                    m = this.app.data.doc.comments.getCommentByRcId(c) || {},
                    p = m.body,
                    h = m.pos,
                    f = m.len,
                    v = m.comment_id;
                  p &&
                    (a && this.app.data.selection.exitCommentBody(),
                    r && this.app.uilManager.resetCommentElements(),
                    p.len <= 1 || n
                      ? (this.app.editor.cmdExecutor.exec({
                          name: "resetComment",
                          param: { pos: h, len: f, bSendSelectionBack: u },
                        }),
                        this.app.viewUIL.typoUpdate())
                      : (window.collection(
                          "commandbar",
                          "click",
                          "comment_send"
                        ),
                        this.app.commentsDataManager.notifyComment({
                          id: v,
                          isVoice: !1,
                          text: this.app.data.doc.getText(p.pos, p.len),
                          duration: 0,
                        })),
                    this.dataHandler.resetTempCommentBubble(),
                    this.update(),
                    d &&
                      this.app.data.selection.setPosition(
                        h,
                        h + Math.max(f - 1, 0),
                        { isSend: !0 }
                      ));
                },
              },
              {
                key: "commitOrDiscardComment",
                value: function () {
                  var e = this;
                  this.commitTempComment({
                    isUpdatePosition: !0,
                    callback: function (t) {
                      t ||
                        e.discardTempComment({
                          isForce: !1,
                          isUpdatePosition: !0,
                        });
                    },
                  });
                },
              },
              {
                key: "restoreTempComment",
                value: function () {
                  var e = this.app.data,
                    t = e.selection,
                    n = e.doc,
                    i = t.getNormalRange(),
                    a = n.commentBodys.getCommentByPos(i.pos);
                  if (a) {
                    var o = a.comment_id,
                      r = a.rc_id,
                      s = a.pos,
                      d = a.len,
                      l = n.commentBubbles.getBubbleByRange(s, d);
                    if (l) {
                      var u = l.id,
                        c = l.range,
                        m = c.pos,
                        p = c.len,
                        h =
                          !this.dataHandler.hasTempComment ||
                          this.dataHandler.tempBubbleId !== u,
                        f = { pos: m, len: p },
                        v = this.app.commentsDataManager.getCommentCache(o),
                        g = v && v.p_comment_id;
                      this.dataHandler.setTempCommentBubble({
                        commentId: o,
                        rcId: r,
                        bubbleId: u,
                        replyId: g,
                        range: f,
                        isNotifyTempComment: !1,
                      }),
                        this.getAllDataDraw(),
                        h
                          ? this.setActive(f, u, !1, null, "", !1, !0)
                          : this.update(),
                        this.dataHandler.ModifyModalByIndex("", u);
                    }
                  }
                },
              },
              {
                key: "switchTempComment",
                value: function () {
                  var e = this.app.data.selection;
                  this.dataHandler.tempRcId !== e.selContext.getCommentRcId() &&
                    (this.app.uilManager.resetCommentElements(),
                    this.restoreTempComment());
                },
              },
              {
                key: "resetCommentSelection",
                value: function (e) {
                  var t = void 0,
                    n = void 0;
                  switch (!0) {
                    case void 0 !== e.pos && void 0 !== e.len:
                      t = e.pos + e.len - 1;
                      break;
                    case void 0 !== e.comment_id:
                      t =
                        (n = this.app.data.doc.comments.getCommentByCommentId(
                          e.comment_id
                        )).pos +
                        n.len -
                        1;
                      break;
                    case void 0 !== e.rc_id:
                      t =
                        (n = this.app.data.doc.comments.getCommentByRcId(
                          e.rc_id
                        )).pos +
                        n.len -
                        1;
                  }
                  this.app.uilManager.resetCommentElements(),
                    this.app.data.selection.setPosition(t, t, { isSend: !0 });
                },
              },
              {
                key: "openCommentsModalByRange",
                value: function (e) {
                  var t = this,
                    n = this.app.data.doc.commentBubbles.getBubbleByRange(
                      e.pos,
                      e.len
                    );
                  if (n && 0 !== n.length && this.commentVisible) {
                    var i = this.dataHandler.currItemId === n.id;
                    (this.selectionCache = e),
                      i ||
                        this.activeRender({
                          range: e,
                          id: n.id,
                          focus: !0,
                          data: n,
                          cb: null,
                          type: "point",
                        }),
                      requestAnimationFrame(function () {
                        t.insertTempComment({ range: e });
                      });
                  } else this.insertTempComment({ range: e });
                },
              },
              {
                key: "adjustCommentRange",
                value: function () {
                  var e = this.app.data.selection,
                    t = e.getNormalRange(),
                    n =
                      window.APP.restrictEditHandler.readonlyProtection.adjustEditableRange(
                        t
                      );
                  (n.pos === t.pos && n.len === t.len) ||
                    e.setPosition(n.pos, n.pos + n.len, { isSend: !0 });
                },
              },
              {
                key: "trackChange",
                value: function () {
                  C.default.dispatchEvent(
                    C.default.revision.REVISION_TRACK_CHANGE,
                    {
                      isTrackingChanges:
                        this.app.data.doc.textStream.getRevisionTextStream()
                          .isTrackingChanges,
                    }
                  );
                },
              },
              {
                key: "handleBookmark",
                value: function () {
                  if (this.app.isFirstTimeHandleBookmark) {
                    var e = this.bookmarkInfo;
                    if (!e) return;
                    var t = e.inComment,
                      n = e.commentRange;
                    if (!t) return;
                    return (
                      (this.selectionCache = n),
                      this.app.data.doc.commentBubbles.getBubbleByRange(n.pos)
                        .id
                    );
                  }
                },
              },
              {
                key: "trackRevisionHandle",
                value: function (e) {
                  var t = e.detail.enable;
                  window.APP.data.doc.textStream
                    .getRevisionTextStream()
                    .setTrackChanges(t);
                },
              },
              {
                key: "diff",
                value: function (e) {
                  if (
                    "[object Array]" === window.utils.Lodash.getType(e) &&
                    0 !== e.length
                  ) {
                    var t = Math.max.apply(Math, r()(e));
                    return (
                      t !== this.usedPageMax && ((this.usedPageMax = t), !0)
                    );
                  }
                  console.log("need array");
                },
              },
              {
                key: "create",
                value:
                  ((i = d()(
                    regeneratorRuntime.mark(function e() {
                      return regeneratorRuntime.wrap(
                        function (e) {
                          for (;;)
                            switch ((e.prev = e.next)) {
                              case 0:
                                (this.usedPageMax = 0),
                                  this.getAllDataDraw(),
                                  Object(_.hasQuery)("version")
                                    ? (this.update(),
                                      this.allData ||
                                        this.versionCompare ||
                                        ((this.versionCompare = new P(
                                          this.workspace,
                                          this,
                                          this.app
                                        )),
                                        (this.allData =
                                          this.versionCompare.allData)),
                                      this.renderHandler.drawComment())
                                    : ((this.firstLocatePos =
                                        this.getFirstLocatePos()),
                                      this.update({
                                        left: this.dataHandler.getLeft(),
                                      }),
                                      this.workspace.resizeIfNecessary());
                              case 3:
                              case "end":
                                return e.stop();
                            }
                        },
                        e,
                        this
                      );
                    })
                  )),
                  function () {
                    return i.apply(this, arguments);
                  }),
              },
              {
                key: "onScrollSlide",
                value:
                  ((n = d()(
                    regeneratorRuntime.mark(function e(t) {
                      var n,
                        i,
                        a,
                        o,
                        s,
                        d,
                        l,
                        u,
                        c = this;
                      return regeneratorRuntime.wrap(
                        function (e) {
                          for (;;)
                            switch ((e.prev = e.next)) {
                              case 0:
                                if (this.isCommentBubbleStatus) {
                                  e.next = 2;
                                  break;
                                }
                                return e.abrupt("return");
                              case 2:
                                if (
                                  ((this.scrollTop =
                                    this.app.workspace.element.cacheDOMAttr.scrollTop),
                                  !this.disableScrollFetch)
                                ) {
                                  e.next = 6;
                                  break;
                                }
                                return (
                                  (this.disableScrollFetch = !1),
                                  e.abrupt("return")
                                );
                              case 6:
                                if (
                                  !(
                                    this.diffPages(t) &&
                                    this.app.servicesLoader &&
                                    this.app.servicesLoader.commentsDataManager
                                  )
                                ) {
                                  e.next = 16;
                                  break;
                                }
                                if (!Object(_.hasQuery)("version")) {
                                  e.next = 10;
                                  break;
                                }
                                return (
                                  (e.next = 10),
                                  this.versionCompare.getDocData()
                                );
                              case 10:
                                (n = this.dataHandler.findCommentGroupById(
                                  I.TEMP
                                )),
                                  (i = this.dataHandler.currItemId),
                                  (a = null),
                                  -1 !== n &&
                                    void 0 !== n &&
                                    ((a = this.dataHandler.data[n]),
                                    ((o = E.default.locate(
                                      this.app.data,
                                      a.range.pos,
                                      null,
                                      this.app.data.typoinfo,
                                      "line"
                                    )) &&
                                      void 0 !== o.layoutIndex) ||
                                      (i === I.TEMP
                                        ? ((a = null),
                                          this.dataHandler.setModalVisibleById(
                                            null
                                          ))
                                        : (a = null))),
                                  this.getScrollData(),
                                  this.onWebModeScroll.isScroll
                                    ? ((s = this.dataHandler.data.find(
                                        function (e) {
                                          return (
                                            e.id === c.onWebModeScroll.dataId
                                          );
                                        }
                                      )),
                                      (d = this.calculateScrollTop(s)),
                                      (l = d.pageIndex),
                                      (u = d.srcollTop),
                                      C.default.dispatchEvent(
                                        C.default.comments.CR_PAGE_SCROLL,
                                        { pageIndex: l, scrollTop: u }
                                      ))
                                    : this.app.isWebMode() &&
                                      void 0 === this.dataHandler.currItemId &&
                                      C.default.dispatchEvent(
                                        C.default.comments.CR_PAGE_SCROLL,
                                        { pageIndex: 0, scrollTop: 0 }
                                      );
                              case 16:
                                (this.onWebModeScroll.isScroll = !1),
                                  this.dataHandler.setCardVisible(),
                                  this.update({ trigger: "scroll" }),
                                  this.workspace.resizeIfNecessary({
                                    preventFocus: !0,
                                  }),
                                  this.judgeUsedPage() &&
                                    ((this.renderUsedPage = [].concat(
                                      r()(this.app.workspace.currentUsedPage)
                                    )),
                                    this.renderHandler.drawComment());
                              case 21:
                              case "end":
                                return e.stop();
                            }
                        },
                        e,
                        this
                      );
                    })
                  )),
                  function (e) {
                    return n.apply(this, arguments);
                  }),
              },
              {
                key: "onScrollVisible",
                value: function () {
                  this.isCommentBubbleStatus &&
                    (this.dataHandler.setCardVisible(),
                    this.update({ trigger: "scroll" }));
                },
              },
              {
                key: "judgeUsedPage",
                value: function () {
                  var e = this.app.workspace.currentUsedPage;
                  if (!this.renderUsedPage || !e) return !0;
                  if (this.renderUsedPage.length !== e.length) return !0;
                  for (var t = 0; t < this.renderUsedPage.length; t++)
                    if (this.renderUsedPage[t] !== e[t]) return !0;
                  return !1;
                },
              },
              {
                key: "selectionChange",
                value: function (e, t) {
                  if (
                    this.isCommentBubbleStatus &&
                    (this.dataHandler.onSelectionChanged(),
                    this.workspace.commentRenderHandler.onSelectionChanged(),
                    this.revisionLinesManager.onSelectionChanged(),
                    this.app.data.doc.getSubDocType(e.pos) !== k.Comment)
                  ) {
                    if (!t) return void console.log("no param");
                    if (
                      (this.commentTip.updateAddPos(),
                      t.isClick || t.isTripleTap)
                    )
                      this.openModalByRange(e);
                    else
                      try {
                        var n =
                          this.app.workspace.revisionComment.dataHandler.getCurrentCommentRange();
                        if (window.APP.restrictEditHandler.isInFormProtectMode)
                          return;
                        if (n) {
                          var i = e.pos,
                            a = i + e.len,
                            o = n.pos,
                            r = o + n.len;
                          if (o <= i && r >= a) return;
                          this.openModalByRange(e);
                        }
                      } catch (e) {}
                  }
                },
              },
              {
                key: "backfillCurr",
                value: function (e) {
                  if (this.commentVisible) {
                    var t = this.dataHandler.currItemId,
                      n = this.dataHandler.dataIdObj[t];
                    if (
                      t &&
                      n &&
                      !this.dataHandler.data.find(function (e) {
                        return e.id === t;
                      })
                    ) {
                      var i = this.app.data.doc.commentBubbles.getBubbleById(t);
                      if (!i) return;
                      var a = i.pos,
                        o = i.len;
                      (n.range.pos = a), (n.range.len = o);
                      var r = this.app.data.typoinfo.layout_pages;
                      e
                        .map(function (e) {
                          var t = r[e];
                          return t.range || t.page.range;
                        })
                        .some(function (e) {
                          return (
                            Math.max(a, e.pos) <= Math.min(a + o, e.pos + e.len)
                          );
                        }) && this.dataHandler.data.unshift(n);
                    }
                  }
                },
              },
              {
                key: "onModifyComments",
                value: function (e, t) {
                  t.changes.some(function (e) {
                    return e.diff.isDone;
                  }) &&
                    (this.getAllData(),
                    this.update(),
                    this.renderHandler.drawComment());
                },
              },
              {
                key: "judgeHasNewRevision",
                value: function (e) {
                  var t = this,
                    n = !1,
                    i = void 0;
                  if (
                    e.type === I.NOTIFY_TYPE.setProp ||
                    e.type === I.NOTIFY_TYPE.delInsSame
                  ) {
                    var a = this.app.data.selection.getNormalRange();
                    if (
                      (i = this.dataHandler.getRevisionAndCommentData(a)) &&
                      i.type !== I.CR_TYPE.comments
                    )
                      if (i.data.length > 0)
                        i.data.filter(function (e) {
                          return t.dataHandler.dataIdObj[e.rc_id];
                        }) && (n = !0);
                  }
                  return { hasNew: n, rc: i };
                },
              },
              {
                key: "resetTempCommentWhenDeleted",
                value: function (e) {
                  var t = this.app.uilManager.undoRedoHandler.state.isUndoRedo,
                    n = this.app.isCmdExecutingByCurrentUser;
                  if (this.dataHandler.hasTempComment) {
                    var i = this.app.data.doc,
                      a = this.dataHandler.tempCommentId,
                      o =
                        !a || a === I.TEMP || i.commentBubbles.getBubbleById(a),
                      r =
                        !e && this.dataHandler.tempReplyId
                          ? i.comments.getCommentByCommentId(
                              this.dataHandler.tempReplyId
                            )
                          : null;
                    if (!t)
                      return (
                        o || n
                          ? r ||
                            !this.dataHandler.tempReplyId ||
                            n ||
                            window.Toast.info(
                              _i18n(
                                "applications.writer.components.other.Comment.replyCommentDeletedByCooper",
                                "你引用的评论已被删除"
                              )
                            )
                          : (this.resetTempComment(),
                            window.Toast.info(
                              _i18n(
                                "applications.writer.components.other.Comment.commentDeletedByCooper",
                                "其他协作者删除了这条评论"
                              )
                            )),
                        !0
                      );
                    o || this.resetTempComment();
                  }
                  return !1;
                },
              },
              {
                key: "judgeFitOrOther",
                value: function () {
                  if (!this.dataHandler.currItemId) {
                    var e = this.getFirstLocatePos();
                    e !== this.firstLocatePos
                      ? ((this.firstLocatePos = e), this.doModalToFit())
                      : this.doModalToFitOther();
                  }
                },
              },
              {
                key: "getNextScroll",
                value: function (e, t) {
                  var n = this.dataHandler.dataIdObj[e];
                  if (!n || !t) return this.scrollTop;
                  return (
                    this.dataHandler.getPosByRange(n.range) -
                    this.app.workspace.element.clientHeight / 2 +
                    30
                  );
                },
              },
              {
                key: "activeRender",
                value: function (e) {
                  var t = e.range,
                    n = e.id,
                    i = e.focus,
                    a = void 0 !== i && i,
                    o = e.data,
                    r = e.cb,
                    s = e.type,
                    d = e.forceUpdate,
                    l = e.useTrans,
                    u = void 0 === l || l;
                  this.renderHandler.outCommentPara(),
                    this.setActive(t, n, a, r, s, u, d),
                    this.app.data.selection.inactiveCommentPara(),
                    o.type === I.CR_TYPE.comments &&
                      o.data.length > 0 &&
                      this.renderHandler.activeCommentPara({
                        detail: { range: t, comments: o.data, isPara: !0 },
                      }),
                    Object(_.hasQuery)("version") &&
                      this.versionCompare &&
                      C.default.dispatchEvent(
                        C.default.revision.REVISION_ACTIVE_CHANGE,
                        { curId: n, data: this.versionCompare.allData }
                      ),
                    C.default.dispatchEvent(
                      C.default.revision.ON_REVISION_FILTER_ACTIVE_CHANGE
                    );
                },
              },
              {
                key: "onActiveRenderAndSetPos",
                value: function (e, t, n, i) {
                  if (
                    (this.activeRender({
                      range: e,
                      id: t,
                      focus: !1,
                      data: n,
                      cb: i,
                    }),
                    n.type === I.CR_TYPE.comments && n.data.length > 0)
                  ) {
                    this.app.data.selection.selContext.isInComment() &&
                      this.app.uilManager.exitCommentBody();
                    var a = n.data[0].pos;
                    this.app.data.selection.setPosition(a, null, {
                      updateOnly: !0,
                      isComment: !0,
                      isSend: !0,
                    }),
                      this.makeCommentAreaVisible(a);
                  }
                },
              },
              {
                key: "getFirstLocatePos",
                value: function () {
                  var e = this.dataHandler.data;
                  if (e && e.length > 0) {
                    var t = (e = this.dataHandler.data[0]).range.pos,
                      n = this.app.data.typoinfo.pagePos,
                      i = 0;
                    if (n)
                      for (var a = 0; a < n.length; a++)
                        if (a.beginPos < t && a.endPos > t) {
                          i = a;
                          break;
                        }
                    return (
                      this.app.data.typoinfo.getLayoutPageCache(i),
                      E.default.locate(
                        this.app.data,
                        e.range.pos,
                        null,
                        this.app.data.typoinfo,
                        "line"
                      ).posY * this.app.workspace.config.zoom
                    );
                  }
                  return !1;
                },
              },
              {
                key: "realTimeRefresh",
                value: function (e) {
                  this.isCommentBubbleStatus &&
                    (this.update(), this.refresh(e));
                },
              },
              {
                key: "checkIsCommentOrRevisionBubbleEditable",
                value: function (e) {
                  var t = e.type;
                  if (this.app.data.selection.selContext.isParagraphSetting)
                    return !1;
                  var n = e.range,
                    i = n.len,
                    a = n.pos,
                    o = Object(z.checkIfCommentOrRevisionEditable)({
                      begin: a,
                      end: a + i,
                      type: t,
                    });
                  return "comments" === e.type
                    ? !(
                        this.app.restrictEditHandler.isInFormProtectMode ||
                        !e.isTemp
                      ) ||
                        (!!o &&
                          !(
                            !this.app.data.selection.selInfo.info.isInComment &&
                            this.app.isCommentDisabledInRestrictEditMode()
                          ) &&
                          (this.app.isReadOnlyComment() ||
                            (!this.app.isReadOnly() && this.app.isAclComment)))
                    : !this.app.isReadOnly() && o;
                },
              },
              {
                key: "makeCommentAreaVisible",
                value: function (e, t) {
                  var n = window.APP.workspace;
                  n.makeContentVisible(e, {
                    isRefocusComment: t,
                    isTimeLimited: !1,
                    adjustWhenInvisible: !0,
                    diffY: n.element.cacheDOMAttr.clientHeight / 3,
                    diffX: n.element.cacheDOMAttr.clientWidth / 3,
                  });
                },
              },
              {
                key: "isReEditComment",
                get: function () {
                  return (
                    this.dataHandler.reEditCommentId &&
                    this.dataHandler.reEditCommentId ===
                      this.dataHandler.tempCommentId
                  );
                },
              },
              {
                key: "isRevisionVisible",
                get: function () {
                  return (
                    !window.__CONFIG__.wps.disableRevisionComment &&
                    !this.app.coreDataInvalid() &&
                    this.app.data.doc.viewSettings.isShowRevisionFrame()
                  );
                },
              },
              {
                key: "isCommentBubbleStatus",
                get: function () {
                  return (
                    this.app.commentShowStatus.commentBubble ||
                    this.revisionVisibleStatus
                  );
                },
              },
            ]),
            t
          );
        })(b.a);
    },
    14488: function (e, t, n) {
      "use strict";
      Object.defineProperty(t, "__esModule", { value: !0 });
      var i = (function () {
        function e() {
          this.commentComponentInfoList = [];
        }
        return (
          (e.prototype.onCommentComponentMounted = function (e) {
            var t = this.getIndex(e);
            -1 !== t && this.commentComponentInfoList.splice(t, 1),
              this.commentComponentInfoList.push(e);
          }),
          (e.prototype.onCommentComponentUnMounted = function (e) {
            var t = this.getIndex(e);
            -1 !== t && this.commentComponentInfoList.splice(t, 1);
          }),
          (e.prototype.getCommentComponentInfo = function (e) {
            if (!e.rcId && !e.commentId) return null;
            var t = this.getIndex(e);
            return -1 !== t ? this.commentComponentInfoList[t] : null;
          }),
          (e.prototype.getIndex = function (e) {
            return this.commentComponentInfoList.findIndex(function (t) {
              var n = t.rcId && t.rcId === e.rcId,
                i = t.commentId && t.commentId === e.commentId,
                a = !e.source || e.source === t.source;
              return (n || i) && a;
            });
          }),
          e
        );
      })();
      t.default = i;
    },
    1954: function (e, t, n) {
      "use strict";
      Object.defineProperty(t, "__esModule", { value: !0 }),
        (t.getPraiseEmoji =
          t.getEmojiById =
          t.getEmojiListOrder =
          t.idToEmoji =
          t.emojiMap =
            void 0);
      var i = n(21);
      t.emojiMap = [
        {
          id: "001",
          name: _i18n(
            "applications.writer.helpers.emojiController.emoji.praise",
            "点赞"
          ),
          value: "praise",
          unicode: "👍",
        },
        {
          id: "002",
          name: _i18n(
            "applications.writer.helpers.emojiController.emoji.ok",
            "好的"
          ),
          value: "ok",
          unicode: "👌",
        },
        {
          id: "003",
          name: _i18n(
            "applications.writer.helpers.emojiController.emoji.rose",
            "鲜花"
          ),
          value: "rose",
          unicode: "🌹",
        },
        {
          id: "004",
          name: _i18n(
            "applications.writer.helpers.emojiController.emoji.hug_fist",
            "抱拳"
          ),
          value: "hug_fist",
          unicode: "🙏",
        },
        {
          id: "005",
          name: _i18n(
            "applications.writer.helpers.emojiController.emoji.congratulate",
            "庆祝"
          ),
          value: "congratulate",
          unicode: "🎉",
        },
      ];
      t.idToEmoji = function () {
        return t.emojiMap.reduce(function (e, t) {
          var n = t.id,
            i = t.name,
            a = t.value;
          return (e[n] = { name: i, value: a }), e;
        }, {});
      };
      t.getEmojiListOrder = function () {
        return t.emojiMap.map(function (e) {
          return e.id;
        });
      };
      t.getEmojiById = function (e) {
        if (!e) return null;
        var n = t.emojiMap.find(function (t) {
          return t.id === e;
        });
        return n ? i.__assign({}, n) : null;
      };
      t.getPraiseEmoji = function () {
        var e = t.emojiMap.find(function (e) {
          return "praise" === e.value;
        });
        return e ? i.__assign({}, e) : null;
      };
    },
    2200: function (e, t, n) {
      "use strict";
      Object.defineProperty(t, "__esModule", { value: !0 }),
        (t.splitFontProperty =
          t.getRealFontName =
          t.changeFontNameInText =
          t.getFontNameToDisplay =
            void 0);
      var i = n(28),
        a = new Map();
      function o(e) {
        if (window.__CONFIG__.useSansZh && !i.isWindows) {
          var t = e.replace(/微软雅黑/g, "雅黑");
          return (t = t.replace(/Microsoft YaHei/g, "YaHei"));
        }
        return e;
      }
      (t.getFontNameToDisplay = function (e) {
        var t = o(e);
        return t !== e && a.set(t, e), t;
      }),
        (t.changeFontNameInText = function (e) {
          return o(e);
        }),
        (t.getRealFontName = function (e) {
          return a.has(e) ? a.get(e) : e;
        }),
        (t.splitFontProperty = function (e) {
          var t = document.createElement("text");
          if (((t.style.font = e), !t.style.font)) return null;
          var n = t.style,
            i = n.fontSize,
            a = n.fontFamily,
            o = n.fontStyle,
            r = n.fontVariant,
            s = n.fontWeight,
            d = n.lineHeight;
          return {
            fontSize: parseInt(i),
            fontFamily: a,
            fontStyle: o,
            fontVariant: r,
            fontWeight: s,
            lineHeight: d,
          };
        });
    },
    303: function (e, t) {
      var n = Array.isArray;
      e.exports = n;
    },
    3134: function (e, t, n) {
      "use strict";
      Object.defineProperty(t, "__esModule", { value: !0 }),
        (t.isRevisionVisibleByFilter = t.buildFilterOptions = void 0);
      var i = n(21),
        a = i.__importDefault(n(381)),
        o = i.__importDefault(n(1022)),
        r = ["insert", "delete", "format"],
        s = {
          insert: {
            unifiedType: "insert",
            label: _i18n(
              "applications.writer.components.CommandBars.TaskPane.RevisionFilter.insertRevision",
              "插入"
            ),
          },
          delete: {
            unifiedType: "delete",
            label: _i18n(
              "applications.writer.components.CommandBars.TaskPane.RevisionFilter.deleteRevision",
              "删除"
            ),
          },
          format: {
            unifiedType: "format",
            label: _i18n(
              "applications.writer.components.CommandBars.TaskPane.RevisionFilter.formatRevision",
              "格式设置"
            ),
          },
          paraFormat: {
            unifiedType: "format",
            label: _i18n(
              "applications.writer.components.CommandBars.TaskPane.RevisionFilter.formatRevision",
              "格式设置"
            ),
          },
        };
      (t.buildFilterOptions = function (e) {
        var t = new Set();
        return {
          users: e.reduce(function (e, n) {
            var i = n.user,
              a = n.userID || "".concat("__NO_USER_ID__").concat(i);
            return t.has(a) || (t.add(a), e.push({ label: i, value: a })), e;
          }, []),
          types: r.map(function (e) {
            return { label: s[e].label, value: e };
          }),
        };
      }),
        (t.isRevisionVisibleByFilter = function (e, t) {
          return (
            void 0 === t &&
              (t = (0, o.default)(
                window,
                "APP.workspace.revisionComment.revisionFilterParams",
                {}
              )),
            [
              function (t) {
                var n = t.timeRange;
                if (!n) return !0;
                var i = n[0],
                  o = n[1];
                return (
                  !i ||
                  !o ||
                  !(
                    (0, a.default)(e.date).isBefore((0, a.default)(i), "D") ||
                    (0, a.default)(e.date).isAfter((0, a.default)(o), "D")
                  )
                );
              },
              function (t) {
                var n = t.users;
                if (!n) return !0;
                var i = (n || []).reduce(
                    function (e, t) {
                      return (
                        t.value.startsWith("__NO_USER_ID__")
                          ? e.noIdUsers.push(t)
                          : e.idUsers.push(t),
                        e
                      );
                    },
                    { idUsers: [], noIdUsers: [] }
                  ),
                  a = i.idUsers,
                  o = i.noIdUsers;
                return e.userID
                  ? a.some(function (t) {
                      return t.value === e.userID;
                    })
                  : o.some(function (t) {
                      return t.label === e.user;
                    });
              },
              function (t) {
                var n = t.types;
                if (!n) return !0;
                var i = s[e.type].unifiedType;
                return n.some(function (e) {
                  return e.value === i;
                });
              },
            ].every(function (e) {
              return e(t);
            })
          );
        });
    },
    381: function (e, t, n) {
      e.exports = (function () {
        "use strict";
        var e = 6e4,
          t = 36e5,
          n = "millisecond",
          i = "second",
          a = "minute",
          o = "hour",
          r = "day",
          s = "week",
          d = "month",
          l = "quarter",
          u = "year",
          c = "date",
          m = "Invalid Date",
          p =
            /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,
          h =
            /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,
          f = {
            name: "en",
            weekdays:
              "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split(
                "_"
              ),
            months:
              "January_February_March_April_May_June_July_August_September_October_November_December".split(
                "_"
              ),
            ordinal: function (e) {
              var t = ["th", "st", "nd", "rd"],
                n = e % 100;
              return "[" + e + (t[(n - 20) % 10] || t[n] || t[0]) + "]";
            },
          },
          v = function (e, t, n) {
            var i = String(e);
            return !i || i.length >= t
              ? e
              : "" + Array(t + 1 - i.length).join(n) + e;
          },
          g = {
            s: v,
            z: function (e) {
              var t = -e.utcOffset(),
                n = Math.abs(t),
                i = Math.floor(n / 60),
                a = n % 60;
              return (t <= 0 ? "+" : "-") + v(i, 2, "0") + ":" + v(a, 2, "0");
            },
            m: function e(t, n) {
              if (t.date() < n.date()) return -e(n, t);
              var i = 12 * (n.year() - t.year()) + (n.month() - t.month()),
                a = t.clone().add(i, d),
                o = n - a < 0,
                r = t.clone().add(i + (o ? -1 : 1), d);
              return +(-(i + (n - a) / (o ? a - r : r - a)) || 0);
            },
            a: function (e) {
              return e < 0 ? Math.ceil(e) || 0 : Math.floor(e);
            },
            p: function (e) {
              return (
                { M: d, y: u, w: s, d: r, D: c, h: o, m: a, s: i, ms: n, Q: l }[
                  e
                ] ||
                String(e || "")
                  .toLowerCase()
                  .replace(/s$/, "")
              );
            },
            u: function (e) {
              return void 0 === e;
            },
          },
          w = "en",
          b = {};
        b[w] = f;
        var C = "$isDayjsObject",
          y = function (e) {
            return e instanceof T || !(!e || !e[C]);
          },
          I = function e(t, n, i) {
            var a;
            if (!t) return w;
            if ("string" == typeof t) {
              var o = t.toLowerCase();
              b[o] && (a = o), n && ((b[o] = n), (a = o));
              var r = t.split("-");
              if (!a && r.length > 1) return e(r[0]);
            } else {
              var s = t.name;
              (b[s] = t), (a = s);
            }
            return !i && a && (w = a), a || (!i && w);
          },
          _ = function (e, t) {
            if (y(e)) return e.clone();
            var n = "object" == typeof t ? t : {};
            return (n.date = e), (n.args = arguments), new T(n);
          },
          E = g;
        (E.l = I),
          (E.i = y),
          (E.w = function (e, t) {
            return _(e, {
              locale: t.$L,
              utc: t.$u,
              x: t.$x,
              $offset: t.$offset,
            });
          });
        var T = (function () {
            function f(e) {
              (this.$L = I(e.locale, null, !0)),
                this.parse(e),
                (this.$x = this.$x || e.x || {}),
                (this[C] = !0);
            }
            var v = f.prototype;
            return (
              (v.parse = function (e) {
                (this.$d = (function (e) {
                  var t = e.date,
                    n = e.utc;
                  if (null === t) return new Date(NaN);
                  if (E.u(t)) return new Date();
                  if (t instanceof Date) return new Date(t);
                  if ("string" == typeof t && !/Z$/i.test(t)) {
                    var i = t.match(p);
                    if (i) {
                      var a = i[2] - 1 || 0,
                        o = (i[7] || "0").substring(0, 3);
                      return n
                        ? new Date(
                            Date.UTC(
                              i[1],
                              a,
                              i[3] || 1,
                              i[4] || 0,
                              i[5] || 0,
                              i[6] || 0,
                              o
                            )
                          )
                        : new Date(
                            i[1],
                            a,
                            i[3] || 1,
                            i[4] || 0,
                            i[5] || 0,
                            i[6] || 0,
                            o
                          );
                    }
                  }
                  return new Date(t);
                })(e)),
                  this.init();
              }),
              (v.init = function () {
                var e = this.$d;
                (this.$y = e.getFullYear()),
                  (this.$M = e.getMonth()),
                  (this.$D = e.getDate()),
                  (this.$W = e.getDay()),
                  (this.$H = e.getHours()),
                  (this.$m = e.getMinutes()),
                  (this.$s = e.getSeconds()),
                  (this.$ms = e.getMilliseconds());
              }),
              (v.$utils = function () {
                return E;
              }),
              (v.isValid = function () {
                return !(this.$d.toString() === m);
              }),
              (v.isSame = function (e, t) {
                var n = _(e);
                return this.startOf(t) <= n && n <= this.endOf(t);
              }),
              (v.isAfter = function (e, t) {
                return _(e) < this.startOf(t);
              }),
              (v.isBefore = function (e, t) {
                return this.endOf(t) < _(e);
              }),
              (v.$g = function (e, t, n) {
                return E.u(e) ? this[t] : this.set(n, e);
              }),
              (v.unix = function () {
                return Math.floor(this.valueOf() / 1e3);
              }),
              (v.valueOf = function () {
                return this.$d.getTime();
              }),
              (v.startOf = function (e, t) {
                var n = this,
                  l = !!E.u(t) || t,
                  m = E.p(e),
                  p = function (e, t) {
                    var i = E.w(
                      n.$u ? Date.UTC(n.$y, t, e) : new Date(n.$y, t, e),
                      n
                    );
                    return l ? i : i.endOf(r);
                  },
                  h = function (e, t) {
                    return E.w(
                      n
                        .toDate()
                        [e].apply(
                          n.toDate("s"),
                          (l ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(t)
                        ),
                      n
                    );
                  },
                  f = this.$W,
                  v = this.$M,
                  g = this.$D,
                  w = "set" + (this.$u ? "UTC" : "");
                switch (m) {
                  case u:
                    return l ? p(1, 0) : p(31, 11);
                  case d:
                    return l ? p(1, v) : p(0, v + 1);
                  case s:
                    var b = this.$locale().weekStart || 0,
                      C = (f < b ? f + 7 : f) - b;
                    return p(l ? g - C : g + (6 - C), v);
                  case r:
                  case c:
                    return h(w + "Hours", 0);
                  case o:
                    return h(w + "Minutes", 1);
                  case a:
                    return h(w + "Seconds", 2);
                  case i:
                    return h(w + "Milliseconds", 3);
                  default:
                    return this.clone();
                }
              }),
              (v.endOf = function (e) {
                return this.startOf(e, !1);
              }),
              (v.$set = function (e, t) {
                var s,
                  l = E.p(e),
                  m = "set" + (this.$u ? "UTC" : ""),
                  p = ((s = {}),
                  (s[r] = m + "Date"),
                  (s[c] = m + "Date"),
                  (s[d] = m + "Month"),
                  (s[u] = m + "FullYear"),
                  (s[o] = m + "Hours"),
                  (s[a] = m + "Minutes"),
                  (s[i] = m + "Seconds"),
                  (s[n] = m + "Milliseconds"),
                  s)[l],
                  h = l === r ? this.$D + (t - this.$W) : t;
                if (l === d || l === u) {
                  var f = this.clone().set(c, 1);
                  f.$d[p](h),
                    f.init(),
                    (this.$d = f.set(c, Math.min(this.$D, f.daysInMonth())).$d);
                } else p && this.$d[p](h);
                return this.init(), this;
              }),
              (v.set = function (e, t) {
                return this.clone().$set(e, t);
              }),
              (v.get = function (e) {
                return this[E.p(e)]();
              }),
              (v.add = function (n, l) {
                var c,
                  m = this;
                n = Number(n);
                var p = E.p(l),
                  h = function (e) {
                    var t = _(m);
                    return E.w(t.date(t.date() + Math.round(e * n)), m);
                  };
                if (p === d) return this.set(d, this.$M + n);
                if (p === u) return this.set(u, this.$y + n);
                if (p === r) return h(1);
                if (p === s) return h(7);
                var f =
                    ((c = {}), (c[a] = e), (c[o] = t), (c[i] = 1e3), c)[p] || 1,
                  v = this.$d.getTime() + n * f;
                return E.w(v, this);
              }),
              (v.subtract = function (e, t) {
                return this.add(-1 * e, t);
              }),
              (v.format = function (e) {
                var t = this,
                  n = this.$locale();
                if (!this.isValid()) return n.invalidDate || m;
                var i = e || "YYYY-MM-DDTHH:mm:ssZ",
                  a = E.z(this),
                  o = this.$H,
                  r = this.$m,
                  s = this.$M,
                  d = n.weekdays,
                  l = n.months,
                  u = n.meridiem,
                  c = function (e, n, a, o) {
                    return (e && (e[n] || e(t, i))) || a[n].slice(0, o);
                  },
                  p = function (e) {
                    return E.s(o % 12 || 12, e, "0");
                  },
                  f =
                    u ||
                    function (e, t, n) {
                      var i = e < 12 ? "AM" : "PM";
                      return n ? i.toLowerCase() : i;
                    };
                return i.replace(h, function (e, i) {
                  return (
                    i ||
                    (function (e) {
                      switch (e) {
                        case "YY":
                          return String(t.$y).slice(-2);
                        case "YYYY":
                          return E.s(t.$y, 4, "0");
                        case "M":
                          return s + 1;
                        case "MM":
                          return E.s(s + 1, 2, "0");
                        case "MMM":
                          return c(n.monthsShort, s, l, 3);
                        case "MMMM":
                          return c(l, s);
                        case "D":
                          return t.$D;
                        case "DD":
                          return E.s(t.$D, 2, "0");
                        case "d":
                          return String(t.$W);
                        case "dd":
                          return c(n.weekdaysMin, t.$W, d, 2);
                        case "ddd":
                          return c(n.weekdaysShort, t.$W, d, 3);
                        case "dddd":
                          return d[t.$W];
                        case "H":
                          return String(o);
                        case "HH":
                          return E.s(o, 2, "0");
                        case "h":
                          return p(1);
                        case "hh":
                          return p(2);
                        case "a":
                          return f(o, r, !0);
                        case "A":
                          return f(o, r, !1);
                        case "m":
                          return String(r);
                        case "mm":
                          return E.s(r, 2, "0");
                        case "s":
                          return String(t.$s);
                        case "ss":
                          return E.s(t.$s, 2, "0");
                        case "SSS":
                          return E.s(t.$ms, 3, "0");
                        case "Z":
                          return a;
                      }
                      return null;
                    })(e) ||
                    a.replace(":", "")
                  );
                });
              }),
              (v.utcOffset = function () {
                return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
              }),
              (v.diff = function (n, c, m) {
                var p,
                  h = this,
                  f = E.p(c),
                  v = _(n),
                  g = (v.utcOffset() - this.utcOffset()) * e,
                  w = this - v,
                  b = function () {
                    return E.m(h, v);
                  };
                switch (f) {
                  case u:
                    p = b() / 12;
                    break;
                  case d:
                    p = b();
                    break;
                  case l:
                    p = b() / 3;
                    break;
                  case s:
                    p = (w - g) / 6048e5;
                    break;
                  case r:
                    p = (w - g) / 864e5;
                    break;
                  case o:
                    p = w / t;
                    break;
                  case a:
                    p = w / e;
                    break;
                  case i:
                    p = w / 1e3;
                    break;
                  default:
                    p = w;
                }
                return m ? p : E.a(p);
              }),
              (v.daysInMonth = function () {
                return this.endOf(d).$D;
              }),
              (v.$locale = function () {
                return b[this.$L];
              }),
              (v.locale = function (e, t) {
                if (!e) return this.$L;
                var n = this.clone(),
                  i = I(e, t, !0);
                return i && (n.$L = i), n;
              }),
              (v.clone = function () {
                return E.w(this.$d, this);
              }),
              (v.toDate = function () {
                return new Date(this.valueOf());
              }),
              (v.toJSON = function () {
                return this.isValid() ? this.toISOString() : null;
              }),
              (v.toISOString = function () {
                return this.$d.toISOString();
              }),
              (v.toString = function () {
                return this.$d.toUTCString();
              }),
              f
            );
          })(),
          M = T.prototype;
        return (
          (_.prototype = M),
          [
            ["$ms", n],
            ["$s", i],
            ["$m", a],
            ["$H", o],
            ["$W", r],
            ["$M", d],
            ["$y", u],
            ["$D", c],
          ].forEach(function (e) {
            M[e[1]] = function (t) {
              return this.$g(t, e[0], e[1]);
            };
          }),
          (_.extend = function (e, t) {
            return e.$i || (e(t, T, _), (e.$i = !0)), _;
          }),
          (_.locale = I),
          (_.isDayjs = y),
          (_.unix = function (e) {
            return _(1e3 * e);
          }),
          (_.en = b[w]),
          (_.Ls = b),
          (_.p = {}),
          _
        );
      })();
    },
    3917: function (e, t, n) {
      "use strict";
      Object.defineProperty(t, "__esModule", { value: !0 }),
        (t.makePosVisible =
          t.cleanRevisionContent =
          t.disableRevisionsOperation =
          t.goPrevRevision =
          t.goNextRevision =
          t.goRevision =
          t.getPrevRevision =
          t.getNextRevision =
          t.forEachRevision =
            void 0);
      var i = n(21),
        a = i.__importDefault(n(260)),
        o = n(3134),
        r = i.__importStar(n(298)),
        s = i.__importDefault(n(4057));
      function d(e, t) {
        var n, a;
        void 0 === t && (t = !1);
        var s = window.APP,
          d =
            null ===
              (a = null === (n = s.data) || void 0 === n ? void 0 : n.doc) ||
            void 0 === a
              ? void 0
              : a.revisions;
        if (d) {
          var l = s.isWebMode();
          d.rangeSet.forEachNode(function (n) {
            var a = n.pos,
              d = s.data.doc.getSubDocType(a),
              u = [r.MainText, r.Endnote, r.Footnote];
            return (
              ![
                function (e) {
                  return l
                    ? !u.includes(d)
                    : !i
                        .__spreadArray(
                          i.__spreadArray([], u, !0),
                          [r.HeaderFooter, r.TextboxInHF, r.Textbox],
                          !1
                        )
                        .includes(d);
                },
                function (e) {
                  return (
                    !l &&
                    d === r.HeaderFooter &&
                    "delete" === e.type &&
                    "\r" === e.content &&
                    (function () {
                      var e = s.data.doc.getLimitedRange(a),
                        t = e.pos,
                        n = e.len;
                      return t === a && 1 === n;
                    })()
                  );
                },
                function (e) {
                  if (l) return !1;
                  if (d !== r.Endnote) return !1;
                  var t = s.data.typoinfo.getPosition(e.pos).pos.layoutIndex,
                    n = s.data.typoinfo.layout_pages[t].endnotesRange;
                  return !(n && e.begin >= n.pos && e.end <= n.pos + n.len);
                },
                function (e) {
                  var t,
                    n,
                    i =
                      null ===
                        (n =
                          null === (t = s.editor) || void 0 === t
                            ? void 0
                            : t.viewSettings) || void 0 === n
                        ? void 0
                        : n.revisionMark;
                  return i && !i.isVisibleForUser(e.user || e.author);
                },
                function (e) {
                  return !t && !(0, o.isRevisionVisibleByFilter)(e);
                },
              ].some(function (e) {
                return e(n);
              }) && e(n)
            );
          });
        }
      }
      function l(e) {
        var t,
          n = [],
          i = window.APP.commentShowStatus.commentBubble
            ? window.APP.workspace.revisionComment.dataHandler.currItemId
            : "";
        if (
          (d(function (i) {
            return i.pos === e.pos
              ? (n.push(i), !1)
              : i.pos > e.pos && ((t = i), !0);
          }),
          n.length && i)
        ) {
          var a = n.findIndex(function (e) {
            return i.startsWith(e.rc_id);
          });
          a < n.length - 1 && (t = n[a + 1]);
        }
        return t;
      }
      function u(e) {
        var t,
          n = [],
          i = window.APP.commentShowStatus.commentBubble
            ? window.APP.workspace.revisionComment.dataHandler.currItemId
            : "";
        if (
          (d(function (i) {
            return i.pos === e.pos
              ? (n.push(i), !1)
              : i.pos > e.pos || ((t = i), !1);
          }),
          n.length && i)
        ) {
          var a = n.findIndex(function (e) {
            return i.startsWith(e.rc_id);
          });
          a > 0 && (t = n[a - 1]);
        }
        return t;
      }
      function c(e) {
        var t,
          n = e.pos,
          i = e.len,
          o = e.type,
          d = e.rc_id;
        if (window.APP.commentShowStatus.commentBubble) {
          var l = { range: { pos: n, len: i }, data: { type: o }, id: d },
            u = window.APP.data.doc.getSubDocType(n);
          if ([r.TextboxInHF, r.HeaderFooter].includes(u)) {
            var c =
              window.APP.data.selection.selContext.headerfooterLayoutIndex;
            l.id = "".concat(d, "_").concat(c);
          }
          a.default.dispatchEvent(a.default.comments.ON_ACTIVE, l);
        } else {
          var m =
              null ===
                (t = new s.default(window.APP.data.selection, {
                  begin: n,
                  end: n + i,
                }).begin) || void 0 === t
                ? void 0
                : t.position,
            p = n + i;
          "number" == typeof m && m !== n && (p = n),
            window.APP.data.selection.setPosition(n, p, {
              isClick: !0,
              updateOnly: !0,
            }),
            window.APP.workspace.makesureCursorVisible(!0, !1);
        }
      }
      (t.forEachRevision = d),
        (t.getNextRevision = l),
        (t.getPrevRevision = u),
        (t.goRevision = c),
        (t.goNextRevision = function (e) {
          var t = l(e),
            n = !1;
          t || ((t = l({ pos: -1, len: 0 })), (n = !0)),
            t &&
              (c(t),
              n &&
                window.Toast.success(
                  _i18n(
                    "applications.writer.components.other.Revision.goFirstRevisionTip",
                    "已跳转到第一条修订"
                  )
                ));
        }),
        (t.goPrevRevision = function (e) {
          var t = u(e),
            n = !1;
          t || ((t = u({ pos: 1 / 0, len: 0 })), (n = !0)),
            t &&
              (c(t),
              n &&
                window.Toast.success(
                  _i18n(
                    "applications.writer.components.other.Revision.goLastRevisionTip",
                    "已跳转到最后一条修订"
                  )
                ));
        }),
        (t.disableRevisionsOperation = function () {
          var e,
            t,
            n = window.APP;
          return (
            !!(
              n.coreDataInvalid() ||
              ((t = 0),
              d(function (e) {
                return 1 == ++t;
              }),
              t < 1)
            ) ||
            !(null === (e = n.data.doc.viewSettings) || void 0 === e
              ? void 0
              : e.getRevisionsShowMarkup()) ||
            n.data.selection.selContext.isParagraphSetting
          );
        }),
        (t.cleanRevisionContent = function (e) {
          return e.replace(/\n{3,}/g, "\n").replace(/\r{3,}/g, "\r");
        }),
        (t.makePosVisible = function (e, t) {
          var n = window.APP.workspace;
          n.makeContentVisible(e, {
            isTimeLimited: !1,
            adjustWhenInvisible: !0,
            diffY: null != t ? t : n.element.cacheDOMAttr.clientHeight / 3,
            diffX: n.element.cacheDOMAttr.clientWidth / 3,
          }).promise.catch(function (e) {
            return console.log(e);
          });
        });
    },
    445: function (e, t, n) {
      var i = n(393);
      e.exports = function (e) {
        if ("string" == typeof e || i(e)) return e;
        var t = e + "";
        return "0" == t && 1 / e == -1 / 0 ? "-0" : t;
      };
    },
    527: function (e, t, n) {
      var i = n(303),
        a = n(589),
        o = n(1085),
        r = n(1088);
      e.exports = function (e, t) {
        return i(e) ? e : a(e, t) ? [e] : o(r(e));
      };
    },
    589: function (e, t, n) {
      var i = n(303),
        a = n(393),
        o = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
        r = /^\w*$/;
      e.exports = function (e, t) {
        if (i(e)) return !1;
        var n = typeof e;
        return (
          !(
            "number" != n &&
            "symbol" != n &&
            "boolean" != n &&
            null != e &&
            !a(e)
          ) ||
          r.test(e) ||
          !o.test(e) ||
          (null != t && e in Object(t))
        );
      };
    },
    613: function (e, t, n) {
      var i = n(527),
        a = n(445);
      e.exports = function (e, t) {
        for (var n = 0, o = (t = i(t, e)).length; null != e && n < o; )
          e = e[a(t[n++])];
        return n && n == o ? e : void 0;
      };
    },
    6156: function (e, t, n) {
      "use strict";
      Object.defineProperty(t, "__esModule", { value: !0 }),
        (t.checkHasCommentPermission = t.goToApplyForPermission = void 0);
      var i = n(359),
        a = n(816);
      (t.goToApplyForPermission = function () {
        if (window.__CONFIG__.isShowNoPermissionComponent) {
          var e = ((window.fileInfo && window.fileInfo.user_acl) || {}).update;
          !e && i.canGotoEdit
            ? (0, i.gotoEdit)({ hidesave: !0 })
            : a.canRequestForAuthForSecurityDoc &&
              (0, a.isEditLimitedSecurityDoc)()
            ? (0, a.requestForAuth)({ type: a.AUTH_TYPES.EDIT })
            : e &&
              window.Toast.warn(
                _i18n(
                  "applications.writer.components.mobile.Other.CommentPanel.noCommentPermission",
                  "你没有此操作的权限，请联系所有者修改权限"
                )
              );
        } else
          window.Toast.info(
            _i18n(
              "applications.writer.components.mobile.Other.CommentPanel.noCommentPermission",
              "你没有此操作的权限，请联系所有者修改权限"
            )
          );
      }),
        (t.checkHasCommentPermission = function () {
          return window.APP.functionStatus.comment.hasCommentAuthority
            ? Promise.resolve()
            : Promise.reject();
        });
    },
    636: function (e, t, n) {
      "use strict";
      var i, a, o;
      Object.defineProperty(t, "__esModule", { value: !0 }),
        (t.enableReadingModeSwitch =
          t.enableReadingModeSelector =
          t.getReadingModeSwitchStatus =
          t.getReadingModeStatus =
          t.getReadingModeSelectorStatus =
          t.getEditModeQueryPair =
          t.isNewFile =
          t.isEditEnterMode =
          t.closeReadingMode =
          t.isReadingMode =
            void 0);
      var r = n(21),
        s = r.__importStar(n(28)),
        d = n(6),
        l = r.__importDefault(n(61)),
        u = !!(null ===
          (o =
            null ===
              (a =
                null === (i = window.__WPSENV__) || void 0 === i
                  ? void 0
                  : i.file_info) || void 0 === a
              ? void 0
              : a.file) || void 0 === o
          ? void 0
          : o.corp_id),
        c = s.isMobile,
        m = [l.default.image];
      (t.isReadingMode = function () {
        var e, t, n;
        return (
          !m.includes(window.officeType) &&
          (null ===
            (t =
              null === (e = window.APP) || void 0 === e
                ? void 0
                : e.isReadOnly) || void 0 === t
            ? void 0
            : t.call(e)) &&
          "read" ===
            (null === (n = window.__WPSENV__) || void 0 === n
              ? void 0
              : n.enterMode) &&
          u &&
          !c
        );
      }),
        (t.closeReadingMode = function () {
          (0, d.setQuery)("enterMode", "edit"), location.reload();
        }),
        (t.isEditEnterMode = function () {
          return "edit" === (0, d.getQuery)("enterMode");
        }),
        (t.isNewFile = function () {
          return "true" === (0, d.getQuery)("newFile");
        }),
        (t.getEditModeQueryPair = function () {
          return { enterMode: "edit" };
        });
      t.getReadingModeSelectorStatus = function () {
        var e, t, n, i;
        return null ===
          (i =
            null ===
              (n =
                null ===
                  (t =
                    null === (e = window.__WPSENV__.store) || void 0 === e
                      ? void 0
                      : e.getState) || void 0 === t
                  ? void 0
                  : t.call(e).public) || void 0 === n
              ? void 0
              : n.file) || void 0 === i
          ? void 0
          : i.readingMode;
      };
      t.getReadingModeStatus = function () {
        var e, t, n, i;
        return null ===
          (i =
            null ===
              (n =
                null ===
                  (t =
                    null === (e = window.__WPSENV__.store) || void 0 === e
                      ? void 0
                      : e.getState) || void 0 === t
                  ? void 0
                  : t.call(e).public) || void 0 === n
              ? void 0
              : n.file) || void 0 === i
          ? void 0
          : i.readingModeStatus;
      };
      t.getReadingModeSwitchStatus = function () {
        var e, t, n, i;
        return null ===
          (i =
            null ===
              (n =
                null ===
                  (t =
                    null === (e = window.__WPSENV__.store) || void 0 === e
                      ? void 0
                      : e.getState) || void 0 === t
                  ? void 0
                  : t.call(e).public) || void 0 === n
              ? void 0
              : n.file) || void 0 === i
          ? void 0
          : i.readingModeEnabled;
      };
      t.enableReadingModeSelector = function () {
        return (
          window.APP &&
          window.APP.isReadOnly &&
          !window.APP.isReadOnly() &&
          !!window.__WPSENV__.store.getState().public.file.readingModeEnabled
        );
      };
      t.enableReadingModeSwitch = function () {
        return !1;
      };
    },
    734: function (e, t) {
      e.exports = function (e, t) {
        for (var n = -1, i = null == e ? 0 : e.length, a = Array(i); ++n < i; )
          a[n] = t(e[n], n, e);
        return a;
      };
    },
    816: function (e, t, n) {
      "use strict";
      Object.defineProperty(t, "__esModule", { value: !0 }),
        (t.canRequestForAuthForSecurityDoc =
          t.requestForAuth =
          t.isPrintLimitedSecurityDoc =
          t.isCopyLimitedSecurityDoc =
          t.isEditLimitedSecurityDoc =
          t.isSupportSecurityDoc =
          t.AUTH_TYPES =
            void 0);
      var i = n(21).__importDefault(n(61)),
        a = { EDIT: "edit", COPY: "copy", PRINT: "print", SAVE_AS: "saveAs" };
      t.AUTH_TYPES = a;
      var o = {
        pluginType: window.__WPSPLUGIN__.helper.types.SecureDocApplyAuth,
      };
      var r = [
        i.default.writer,
        i.default.spreadsheet,
        i.default.presentation,
      ].includes(window.officeType);
      function s() {
        return window.APP.getSecurityDocPermission() || {};
      }
      function d() {
        return 1 === s().doctype;
      }
      (t.isSupportSecurityDoc = r),
        (t.isEditLimitedSecurityDoc = function () {
          return d() && !(!0 === s().edit);
        }),
        (t.isCopyLimitedSecurityDoc = function () {
          return d() && !(!0 === s().copy);
        }),
        (t.isPrintLimitedSecurityDoc = function () {
          return d() && !(!0 === s().print);
        }),
        (t.requestForAuth = function (e) {
          return (
            void 0 === e && (e = { type: a.EDIT }),
            window.__WPSPLUGIN__.loader
              .loadSingleInstance(o)
              .then(function (t) {
                return t.show(e.type);
              })
          );
        });
      var l = r && !!window.__WPSPLUGIN__.loader.search(o);
      t.canRequestForAuthForSecurityDoc = l;
    },
  },
]);
